mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
iio: adc: pac1934: check ACPI label duplication
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: 0fb528c825 ("iio: adc: adding support for PAC193x")
Assisted-by: LLM
Signed-off-by: Slavin Liu <bolin.liu@seu.edu.cn>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
This commit is contained in:
parent
137d6ccf0e
commit
64c82e7bd9
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user