From: Florian Fainelli <florian.fainelli@broadcom.com>
To: "Gustavo A. R. Silva" <gustavoars@kernel.org>,
Markus Mayer <mmayer@broadcom.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Viresh Kumar <viresh.kumar@linaro.org>,
Florian Fainelli <florian.fainelli@broadcom.com>
Cc: linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org,
Kees Cook <keescook@chromium.org>
Subject: Re: [PATCH v3] cpufreq: brcmstb-avs-cpufreq: Fix -Warray-bounds bug
Date: Tue, 1 Aug 2023 10:05:11 -0700 [thread overview]
Message-ID: <66e19ae3-253d-5377-5cc2-566ec3cfed49@broadcom.com> (raw)
In-Reply-To: <ZMh45KH2iPIpNktr@work>
[-- Attachment #1.1: Type: text/plain, Size: 1886 bytes --]
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@vger.kernel.org
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
--
Florian
[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-08-01 17:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-01 3:15 [PATCH v3] cpufreq: brcmstb-avs-cpufreq: Fix -Warray-bounds bug Gustavo A. R. Silva
2023-08-01 17:05 ` Florian Fainelli [this message]
2023-08-03 5:56 ` Viresh Kumar
2023-08-03 20:01 ` Gustavo A. R. Silva
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=66e19ae3-253d-5377-5cc2-566ec3cfed49@broadcom.com \
--to=florian.fainelli@broadcom.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=gustavoars@kernel.org \
--cc=keescook@chromium.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mmayer@broadcom.com \
--cc=rafael@kernel.org \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox