mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kees Cook <kees@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Kees Cook <kees@kernel.org>
Cc: Nipun Gupta <nipun.gupta@amd.com>,
	Nikhil Agarwal <nikhil.agarwal@amd.com>,
	"Borislav Petkov (AMD)" <bp@alien8.de>,
	Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@amd.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Ingo Molnar <mingo@kernel.org>, Mark Brown <broonie@kernel.org>,
	Wesley Cheng <quic_wcheng@quicinc.com>,
	Tony Luck <tony.luck@intel.com>,
	Pawan Gupta <pawan.kumar.gupta@linux.intel.com>,
	linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH] mod_devicetable: Enlarge the maximum platform_device_id name length
Date: Mon, 21 Apr 2025 14:30:51 -0700	[thread overview]
Message-ID: <174527104953.545387.8821005974012895763.b4-ty@kernel.org> (raw)
In-Reply-To: <20250415231420.work.066-kees@kernel.org>

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


      parent reply	other threads:[~2025-04-21 21:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-15 23:14 Kees Cook
2025-04-16  6:45 ` Andy Shevchenko
2025-07-04 23:49   ` Vitaly Chikunov
2025-04-21 21:30 ` Kees Cook [this message]

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=174527104953.545387.8821005974012895763.b4-ty@kernel.org \
    --to=kees@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=broonie@kernel.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=nikhil.agarwal@amd.com \
    --cc=nipun.gupta@amd.com \
    --cc=pawan.kumar.gupta@linux.intel.com \
    --cc=pieter.jansen-van-vuuren@amd.com \
    --cc=quic_wcheng@quicinc.com \
    --cc=tony.luck@intel.com \
    /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

all inboxes | Powered by JetHome®