From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E014CC433EF for ; Thu, 10 Mar 2022 07:02:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=D57f4BrVZO/IYs2mlsDjCx1glamCEAt702PqJUnaRbc=; b=aujWmV9zHN55xL aRReLx598AwJ2Je1hFw/kWq9vFNq0za5AVqcaOsVhiWPqT2s35aQTFUMxhHCsl7R/W/0xONUhIFJZ yy3ClEuP8LHxH8MWxwrhktnsVQVXPWXu/1E6yrJDjCe1Cs5tnNRv9Rf/0Ni3EAbDUf6FVoQm2wY5r FHFHffp76OW9kTA1gsvPgPo0B80kMtIkJes6T2RF0pvUX9o/tWtQCT9c3xm3eT2HoEuZJ3JrnnMzG 5REZyk0g/AZAINPSdBa74BprJzVewrN+QBOYk915r9VDq4y9cMiWxSYL3S8thk2lQiScrd3Kjz6Re OVA0P71sxJbaU2gxlQGQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nSCnC-00BgSU-Oy; Thu, 10 Mar 2022 07:00:58 +0000 Received: from verein.lst.de ([213.95.11.211]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nSCn9-00BgRI-Ca for linux-arm-kernel@lists.infradead.org; Thu, 10 Mar 2022 07:00:56 +0000 Received: by verein.lst.de (Postfix, from userid 2407) id 9ABD468CFE; Thu, 10 Mar 2022 08:00:43 +0100 (CET) Date: Thu, 10 Mar 2022 08:00:41 +0100 From: Christoph Hellwig To: Kees Cook Cc: Russell King , Logan Gunthorpe , Martin Oliveira , David Hildenbrand , Andrew Morton , Stephen Rothwell , Zi Yan , Hari Bathini , Minchan Kim , Mike Kravetz , linux-arm-kernel@lists.infradead.org, Christoph Hellwig , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] ARM/dma-mapping: Remove CMA code when not built with CMA Message-ID: <20220310070041.GA24874@lst.de> References: <20220309175107.195182-1-keescook@chromium.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220309175107.195182-1-keescook@chromium.org> User-Agent: Mutt/1.5.17 (2007-11-01) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220309_230055_595091_47C3B404 X-CRM114-Status: GOOD ( 14.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Mar 09, 2022 at 09:51:07AM -0800, Kees Cook wrote: > The MAX_CMA_AREAS could be set to 0, which would result in code that would > attempt to operate beyond the end of a zero-sized array. If CONFIG_CMA > is disabled, just remove this code entirely. Found when building with > -Warray-bounds: > > arch/arm/mm/dma-mapping.c:396:22: warning: array subscript is outside array bounds of 'str > uct dma_contig_early_reserve[0]' [-Warray-bounds] > 396 | dma_mmu_remap[dma_mmu_remap_num].size = size; > | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~ > arch/arm/mm/dma-mapping.c:389:40: note: while referencing 'dma_mmu_remap' > 389 | static struct dma_contig_early_reserve dma_mmu_remap[MAX_CMA_AREAS] __initdata; Looks good: Reviewed-by: Christoph Hellwig _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel