[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <174527104953.545387.8821005974012895763.b4-ty@kernel.org>
Date: Mon, 21 Apr 2025 14:30:51 -0700
From: Kees Cook <kees@...nel.org>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Kees Cook <kees@...nel.org>
Cc: Nipun Gupta <nipun.gupta@....com>,
Nikhil Agarwal <nikhil.agarwal@....com>,
"Borislav Petkov (AMD)" <bp@...en8.de>,
Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@....com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Ingo Molnar <mingo@...nel.org>,
Mark Brown <broonie@...nel.org>,
Wesley Cheng <quic_wcheng@...cinc.com>,
Tony Luck <tony.luck@...el.com>,
Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>,
linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH] mod_devicetable: Enlarge the maximum platform_device_id name length
On Tue, 15 Apr 2025 16:14:24 -0700, Kees Cook wrote:
> The 20 byte length of struct platform_device_id::name is not long enough
> for many devices (especially regulators), where the string initialization
> is getting truncated and missing the trailing NUL byte. This is seen
> with GCC 15's -Wunterminated-string-initialization option:
>
> drivers/regulator/hi6421v530-regulator.c:189:19: warning: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (21 chars into 20 available) [-Wunterminated-string-initialization]
> 189 | { .name = "hi6421v530-regulator" },
> | ^~~~~~~~~~~~~~~~~~~~~~
> drivers/regulator/hi6421v600-regulator.c:278:19: warning: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (21 chars into 20 available) [-Wunterminated-string-initialization]
> 278 | { .name = "hi6421v600-regulator" },
> | ^~~~~~~~~~~~~~~~~~~~~~
> drivers/regulator/lp87565-regulator.c:233:11: warning: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (21 chars into 20 available) [-Wunterminated-string-initialization]
> 233 | { "lp87565-q1-regulator", },
> | ^~~~~~~~~~~~~~~~~~~~~~
> sound/soc/fsl/imx-pcm-rpmsg.c:818:19: warning: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (21 chars into 20 available) [-Wunterminated-string-initialization]
> 818 | { .name = "rpmsg-micfil-channel" },
> | ^~~~~~~~~~~~~~~~~~~~~~
> drivers/iio/light/hid-sensor-als.c:457:25: warning: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (21 chars into 20 available) [-Wunterminated-string-initialization]
> 457 | .name = "HID-SENSOR-LISS-0041",
> | ^~~~~~~~~~~~~~~~~~~~~~
> drivers/iio/light/hid-sensor-prox.c:366:25: warning: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (21 chars into 20 available) [-Wunterminated-string-initialization]
> 366 | .name = "HID-SENSOR-LISS-0226",
> | ^~~~~~~~~~~~~~~~~~~~~~
>
> [...]
Applied to for-next/hardening, thanks!
[1/1] mod_devicetable: Enlarge the maximum platform_device_id name length
https://git.kernel.org/kees/c/94a821d9355c
Take care,
--
Kees Cook
Powered by blists - more mailing lists