* [PATCH] iio: adc: pac1934: check ACPI label duplication
@ 2026-09-13 12:51 Slavin Liu
2026-09-13 17:11 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Slavin Liu @ 2026-09-13 12:51 UTC (permalink / raw)
To: marius.cristea, jic23
Cc: dlechner, nuno.sa, andy, linux-iio, linux-kernel, bolin.liu
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>
---
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);
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] iio: adc: pac1934: check ACPI label duplication
2026-09-13 12:51 [PATCH] iio: adc: pac1934: check ACPI label duplication Slavin Liu
@ 2026-09-13 17:11 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2026-09-13 17:11 UTC (permalink / raw)
To: Slavin Liu
Cc: marius.cristea, dlechner, nuno.sa, andy, linux-iio, linux-kernel
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);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-13 17:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-13 12:51 [PATCH] iio: adc: pac1934: check ACPI label duplication Slavin Liu
2026-09-13 17:11 ` Jonathan Cameron
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®