[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230803055607.ueliy6eofvhoy4gw@vireshk-i7>
Date: Thu, 3 Aug 2023 11:26:07 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: Florian Fainelli <florian.fainelli@...adcom.com>
Cc: "Gustavo A. R. Silva" <gustavoars@...nel.org>,
Markus Mayer <mmayer@...adcom.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@...adcom.com>,
"Rafael J. Wysocki" <rafael@...nel.org>, linux-pm@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org, Kees Cook <keescook@...omium.org>
Subject: Re: [PATCH v3] cpufreq: brcmstb-avs-cpufreq: Fix -Warray-bounds bug
On 01-08-23, 10:05, Florian Fainelli wrote:
> On 7/31/23 20:15, Gustavo A. R. Silva wrote:
> > Allocate extra space for terminating element at:
> >
> > drivers/cpufreq/brcmstb-avs-cpufreq.c:
> > 449 table[i].frequency = CPUFREQ_TABLE_END;
> >
> > and add code comment to make this clear.
> >
> > This fixes the following -Warray-bounds warning seen after building
> > ARM with multi_v7_defconfig (GCC 13):
> > In function 'brcm_avs_get_freq_table',
> > inlined from 'brcm_avs_cpufreq_init' at drivers/cpufreq/brcmstb-avs-cpufreq.c:623:15:
> > drivers/cpufreq/brcmstb-avs-cpufreq.c:449:28: warning: array subscript 5 is outside array bounds of 'void[60]' [-Warray-bounds=]
> > 449 | table[i].frequency = CPUFREQ_TABLE_END;
> > In file included from include/linux/node.h:18,
> > from include/linux/cpu.h:17,
> > from include/linux/cpufreq.h:12,
> > from drivers/cpufreq/brcmstb-avs-cpufreq.c:44:
> > In function 'devm_kmalloc_array',
> > inlined from 'devm_kcalloc' at include/linux/device.h:328:9,
> > inlined from 'brcm_avs_get_freq_table' at drivers/cpufreq/brcmstb-avs-cpufreq.c:437:10,
> > inlined from 'brcm_avs_cpufreq_init' at drivers/cpufreq/brcmstb-avs-cpufreq.c:623:15:
> > include/linux/device.h:323:16: note: at offset 60 into object of size 60 allocated by 'devm_kmalloc'
> > 323 | return devm_kmalloc(dev, bytes, flags);
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > This helps with the ongoing efforts to tighten the FORTIFY_SOURCE
> > routines on memcpy() and help us make progress towards globally
> > enabling -Warray-bounds.
> >
> > Link: https://github.com/KSPP/linux/issues/324
> > Fixes: de322e085995 ("cpufreq: brcmstb-avs-cpufreq: AVS CPUfreq driver for Broadcom STB SoCs")
> > Cc: stable@...r.kernel.org
> > Signed-off-by: Gustavo A. R. Silva <gustavoars@...nel.org>
>
> Reviewed-by: Florian Fainelli <florian.fainelli@...adcom.com>
Applied. Thanks.
--
viresh
Powered by blists - more mailing lists