[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <9059fa71-330f-f04f-b155-2850abb72a71@redhat.com>
Date: Thu, 10 Mar 2022 09:23:44 +0100
From: David Hildenbrand <david@...hat.com>
To: Kees Cook <keescook@...omium.org>,
Russell King <linux@...linux.org.uk>
Cc: Logan Gunthorpe <logang@...tatee.com>,
Martin Oliveira <martin.oliveira@...eticom.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 09.03.22 18:51, 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;
> | ^~~~~~~~~~~~~
>
> Cc: Russell King <linux@...linux.org.uk>
> Cc: Logan Gunthorpe <logang@...tatee.com>
> Cc: Martin Oliveira <martin.oliveira@...eticom.com>
> Cc: David Hildenbrand <david@...hat.com>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Cc: Stephen Rothwell <sfr@...b.auug.org.au>
> Cc: Zi Yan <ziy@...dia.com>
> Cc: Hari Bathini <hbathini@...ux.ibm.com>
> Cc: Minchan Kim <minchan@...nel.org>
> Cc: Mike Kravetz <mike.kravetz@...cle.com>
> Cc: linux-arm-kernel@...ts.infradead.org
> Signed-off-by: Kees Cook <keescook@...omium.org>
Reviewed-by: David Hildenbrand <david@...hat.com>
--
Thanks,
David / dhildenb
Powered by blists - more mailing lists