mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Slavin Liu <bolin.liu@seu.edu.cn>
Cc: marius.cristea@microchip.com, dlechner@baylibre.com,
	nuno.sa@analog.com, andy@kernel.org, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: adc: pac1934: check ACPI label duplication
Date: Sun, 13 Sep 2026 18:11:06 +0100	[thread overview]
Message-ID: <20260913181106.781e6e90@jic23-hlaptop> (raw)
In-Reply-To: <20260913125107.109723-1-bolin.liu@seu.edu.cn>

On Sun, 13 Sep 2026 20:51:07 +0800
Slavin Liu <bolin.liu@seu.edu.cn> wrote:

> A label duplication failure currently reaches the terminating-byte
> write. Release the ACPI result and abort before accessing the missing
> label; earlier labels are managed by devres.
> 
> Detected by static analysis and reviewed with AI-assisted source auditing.
> 
> Fixes: 0fb528c8255b ("iio: adc: adding support for PAC193x")
> Assisted-by: LLM
> Signed-off-by: Slavin Liu <bolin.liu@seu.edu.cn>

Applied to the fixes-togreg branch of iio.git but as it is a low
priority type of fix (these allocations don't fail in practice except
when things are already in a mess!) it may well wait for the next merge
window.

> ---
>  drivers/iio/adc/pac1934.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/iio/adc/pac1934.c b/drivers/iio/adc/pac1934.c
> index 23055405a6e0..de59dc27c440 100644
> --- a/drivers/iio/adc/pac1934.c
> +++ b/drivers/iio/adc/pac1934.c
> @@ -1108,6 +1108,10 @@ static int pac1934_acpi_parse_channel_config(struct i2c_client *client,
>  			devm_kmemdup(dev, rez->package.elements[i].string.pointer,
>  				     (size_t)rez->package.elements[i].string.length + 1,
>  				     GFP_KERNEL);
> +		if (!info->labels[idx]) {
> +			ACPI_FREE(rez);
> +			return -ENOMEM;
> +		}
>  		info->labels[idx][rez->package.elements[i].string.length] = '\0';
>  		info->shunts[idx] = rez->package.elements[i + 1].integer.value * 1000;
>  		info->active_channels[idx] = (info->shunts[idx] != 0);
> 


      reply	other threads:[~2026-09-13 17:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-13 12:51 Slavin Liu
2026-09-13 17:11 ` Jonathan Cameron [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=20260913181106.781e6e90@jic23-hlaptop \
    --to=jic23@kernel.org \
    --cc=andy@kernel.org \
    --cc=bolin.liu@seu.edu.cn \
    --cc=dlechner@baylibre.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marius.cristea@microchip.com \
    --cc=nuno.sa@analog.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®