Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp457219ybl; Wed, 11 Dec 2019 02:34:25 -0800 (PST) X-Google-Smtp-Source: APXvYqxcJRD0u8x0EimddXMKG/4gCTHUhK18cNdBHkbK5MLP5K7FHBdcdkitS9bWpnVsWb9rQjio X-Received: by 2002:a05:6830:50:: with SMTP id d16mr1833797otp.155.1576060465763; Wed, 11 Dec 2019 02:34:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576060465; cv=none; d=google.com; s=arc-20160816; b=J4Vm6bC3cdg2kCvbIbQZVmRw4fW2wuB3HyOlqaxlzgzV6DF9TrjkYsouIz5hWzuRbr 2NIrG/9wbiAH9fd8x+ZFd1J2fwSc1PUk73wlQAUTRlQgTCokKFzLXMRju0LjXZgn6Cde UZE39g0QM5iCAKtoIg/RtCnRe+/g4GF7HaztKIiSPx3YJi86KgArWlg2x0f2Msz5s8tu hVXDA0gztLqkDOpz5b9taEg8Kwa/YlEM6mmNrpwmOFEUqiRCdoUV/1GHo02kmd/bbSqQ CbgUAiLrcQ4bOFrmRkg3me0MII80Rz/leUdU/LtAPVd0Dj8Auu9mbkUOd6+sfz33l2Kb I5AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Cs40jQrViMGV/1nbgUTZMaNYPSQXbvDHFLN+q69nx8s=; b=BIsoi+rFyyxrVlnBmuJ7ElXUuGR0vA3L1jbAIJtcky83mnTyYDhIN6i6/HZG9q0buW gtkMHTMwrLcvkX2tP00bDjvLLeluF3p3NXHIZBlf/QrX3CB0phm6ihCJmWI4+KSF4Hyh a7fYODzJKqGgtr3wWQ8B8qfhR6zSraF6tThI29iTlxzzk22t4ZxUsryTrhWs1zGkRLFy ZVOihKMUPxyFDUPHM2eOE5KV4Zn1fNSjq+l73mT3pMGhyWwT/igP1nkkRl6ClK2ffYph F8SkOvaXwAhZF7CyuQpxXigApzkMDimYuBEpohzs1+PlEd20e939wfC9KtxGtJ++V2Us 7Efg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gyTut+e0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 185si834815oie.52.2019.12.11.02.34.13; Wed, 11 Dec 2019 02:34:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gyTut+e0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728911AbfLKKdl (ORCPT + 99 others); Wed, 11 Dec 2019 05:33:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:49134 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728857AbfLKKdk (ORCPT ); Wed, 11 Dec 2019 05:33:40 -0500 Received: from localhost (unknown [171.76.100.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 83AC5206A5; Wed, 11 Dec 2019 10:33:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576060420; bh=+ZuEN6sbvx+HFSyKNfR9u2DU6UxvtkoeGe1OMt2sqOg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gyTut+e0k0KShiB3ONmjUMsB2d2qtxQJAPj4b2599Rk8xQTs4kDp5HD3wcdY0a+mz 74ALyUrgeY0fjsR8lCzh2KgZDyqTZGdZcMW4VJbPlzqGZ8/tLxZ9/hcPLRv9ZVMH8Z Ru5mZsvkXRfJYWgXT7UstgmHWW2qoQqNliK+tY9E= Date: Wed, 11 Dec 2019 16:03:33 +0530 From: Vinod Koul To: Lukas Wunner Cc: dmaengine@vger.kernel.org, kbuild-all@lists.01.org, linux-kernel@vger.kernel.org, Mark Brown , Nathan Chancellor Subject: Re: [PATCH] dmaengine: Fix access to uninitialized dma_slave_caps Message-ID: <20191211103333.GE2536@vkoul-mobl> References: <201912051630.Cb4fFTp2%lkp@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05-12-19, 12:54, Lukas Wunner wrote: > dmaengine_desc_set_reuse() allocates a struct dma_slave_caps on the > stack, populates it using dma_get_slave_caps() and then accesses one > of its members. > > However dma_get_slave_caps() may fail and this isn't accounted for, > leading to a legitimate warning of gcc-4.9 (but not newer versions): > > In file included from drivers/spi/spi-bcm2835.c:19:0: > drivers/spi/spi-bcm2835.c: In function 'dmaengine_desc_set_reuse': > >> include/linux/dmaengine.h:1370:10: warning: 'caps.descriptor_reuse' is used uninitialized in this function [-Wuninitialized] > if (caps.descriptor_reuse) { > > Fix it, thereby also silencing the gcc-4.9 warning. > > The issue has been present for 4 years but surfaces only now that > the first caller of dmaengine_desc_set_reuse() has been added in > spi-bcm2835.c. Another user of reusable DMA descriptors has existed > for a while in pxa_camera.c, but it sets the DMA_CTRL_REUSE flag > directly instead of calling dmaengine_desc_set_reuse(). Nevertheless, > tag this commit for stable in case there are out-of-tree users. Applied, thanks -- ~Vinod