Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Uwe Kleine-König (The Capable Hub)" <u.kleine-koenig@baylibre.com>
Cc: imx@lists.linux.dev, mfd@lists.linux.dev, Frank.Li@kernel.org,
	lee@kernel.org, wsa+renesas@sang-engineering.com
Subject: Re: [PATCH v2 13/23] mfd: Use named initializers for arrays of i2c_device_id
Date: Wed, 08 Jul 2026 11:24:49 +0000	[thread overview]
Message-ID: <20260708112449.D676D1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <5aec0fc2ac0cd1d2e27027ad0c180e2647bd494e.1783507945.git.u.kleine-koenig@baylibre.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The `rsmu_i2c_id` array is missing its required null-terminating sentinel element.
--

--- Patch [13]: [PATCH v2 13/23] mfd: Use named initializers for arrays of i2c_device_id ---
commit f026cb9dcb83c5116a80b49dec846447e0d9699f
Author: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>

mfd: Use named initializers for arrays of i2c_device_id

This patch updates arrays of i2c_device_id to use named initializers
instead of relying on positional initializers. This improves robustness
against future changes to the struct.

> --- a/drivers/mfd/rsmu_i2c.c
> +++ b/drivers/mfd/rsmu_i2c.c

[ ... ]

> @@ -328,14 +328,13 @@ static void rsmu_i2c_remove(struct i2c_client *client)
>  }
>  
>  static const struct i2c_device_id rsmu_i2c_id[] = {
> -	{ "8a34000",  RSMU_CM },
> -	{ "8a34001",  RSMU_CM },
> -	{ "8a34002",  RSMU_CM },
> -	{ "82p33810", RSMU_SABRE },
> -	{ "82p33811", RSMU_SABRE },
> -	{ "8v19n850", RSMU_SL },
> -	{ "8v19n851", RSMU_SL },
> -	{}
> +	{ .name = "8a34000",  .driver_data = RSMU_CM },
> +	{ .name = "8a34001",  .driver_data = RSMU_CM },
> +	{ .name = "8a34002",  .driver_data = RSMU_CM },
> +	{ .name = "82p33810", .driver_data = RSMU_SABRE },
> +	{ .name = "82p33811", .driver_data = RSMU_SABRE },
> +	{ .name = "8v19n850", .driver_data = RSMU_SL },
> +	{ .name = "8v19n851", .driver_data = RSMU_SL },
>  };

[Severity: High]
Will this lead to an out-of-bounds read during device matching? The
terminating null sentinel was inadvertently removed from the end of the
rsmu_i2c_id array. 

The I2C subsystem (specifically i2c_match_id()) loops over i2c_device_id
arrays until it encounters an element with an empty name string, so it will
now read past the end of the array.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1783507945.git.u.kleine-koenig@baylibre.com?part=13

  reply	other threads:[~2026-07-08 11:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-08 11:15 [PATCH v2 00/23] mfd: Use named initializers for arrays of *_device_data Uwe Kleine-König (The Capable Hub)
2026-07-08 11:15 ` [PATCH v2 13/23] mfd: Use named initializers for arrays of i2c_device_id Uwe Kleine-König (The Capable Hub)
2026-07-08 11:24   ` sashiko-bot [this message]
2026-07-08 12:12   ` Charles Keepax
2026-07-08 12:55   ` André Draszik
2026-07-08 11:15 ` [PATCH v2 21/23] mfd: Unify style of of_device_id arrays Uwe Kleine-König (The Capable Hub)
2026-07-08 11:32   ` sashiko-bot
2026-07-08 12:18   ` Charles Keepax
2026-07-08 12:58   ` André Draszik
2026-07-10 19:36   ` Linus Walleij
2026-07-08 11:34 ` [PATCH v2 00/23] mfd: Use named initializers for arrays of *_device_data Andy Shevchenko
2026-07-09 16:08   ` Uwe Kleine-König (The Capable Hub)

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=20260708112449.D676D1F00A3D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=lee@kernel.org \
    --cc=mfd@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=u.kleine-koenig@baylibre.com \
    --cc=wsa+renesas@sang-engineering.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