patch "iio: adc: mt6359: fix unchecked return value in mt6358_read_imp" added to char-misc-linus
Subsystems (3)
This is a note to let you know that I've just added the patch titled
iio: adc: mt6359: fix unchecked return value in mt6358_read_imp
to my char-misc git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
From f9bbd943c34a9ad60e593a4b99ce2394e4e2381b Mon Sep 17 00:00:00 2001
From: Salah Triki <[email protected]>
Date: Mon, 27 Apr 2026 21:12:38 +0100
Subject: iio: adc: mt6359: fix unchecked return value in mt6358_read_imp
In mt6358_read_imp(), the variable val_v is passed to regmap_read() but the return value is not checked. If the read fails, val_v remains uninitialized and its random stack content is subsequently reported as a measurement result.
Initialize val_v to zero to ensure a predictable value is reported in case of bus failure and to prevent potential stack data leakage. This also satisfies static analyzers that might otherwise flag the variable as used uninitialized.
--- drivers/iio/adc/mt6359-auxadc.c | 1 + 1 file changed, 1 insertion(+)
drivers/iio/adc/mt6359-auxadc.c +1 -0
@@ -497,6 +497,7 @@ static int mt6358_read_imp(struct mt6359_auxadc *adc_dev,return ret;/* Read the params before stopping */ + val_v =0 ;regmap_read (regmap, reg_adc0 + (cinfo->imp_adc_num <<1 ), &val_v);mt6358_stop_imp_conv (adc_dev);
Signature · 1 line
2.54.0