[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220310070041.GA24874@lst.de>
Date: Thu, 10 Mar 2022 08:00:41 +0100
From: Christoph Hellwig <hch@....de>
To: Kees Cook <keescook@...omium.org>
Cc: Russell King <linux@...linux.org.uk>,
Logan Gunthorpe <logang@...tatee.com>,
Martin Oliveira <martin.oliveira@...eticom.com>,
David Hildenbrand <david@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Stephen Rothwell <sfr@...b.auug.org.au>,
Zi Yan <ziy@...dia.com>, Hari Bathini <hbathini@...ux.ibm.com>,
Minchan Kim <minchan@...nel.org>,
Mike Kravetz <mike.kravetz@...cle.com>,
linux-arm-kernel@...ts.infradead.org,
Christoph Hellwig <hch@....de>, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH] ARM/dma-mapping: Remove CMA code when not built with
CMA
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 <unknown> 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 <hch@....de>
Powered by blists - more mailing lists