2022-09-16 07:05:27

by Dan Carpenter

[permalink] [raw]
Subject: [jic23-iio:testing 149/150] drivers/iio/dac/ad5593r.c:87 ad5593r_gpio_read() error: uninitialized symbol 'val'.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git testing
head: 62a6e699f4669b2c51f408273756f93b21c9f1a1
commit: 53b6e3b2164c5807669fbf6b3df0e1494b4d03b8 [149/150] iio: dac: ad5593r: Fix i2c read protocol requirements
config: x86_64-randconfig-m001
compiler: gcc-11 (Debian 11.3.0-5) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>

smatch warnings:
drivers/iio/dac/ad5593r.c:87 ad5593r_gpio_read() error: uninitialized symbol 'val'.

vim +/val +87 drivers/iio/dac/ad5593r.c

56ca9db862bf3d7 Paul Cercueil 2016-04-05 79 static int ad5593r_gpio_read(struct ad5592r_state *st, u8 *value)
56ca9db862bf3d7 Paul Cercueil 2016-04-05 80 {
56ca9db862bf3d7 Paul Cercueil 2016-04-05 81 struct i2c_client *i2c = to_i2c_client(st->dev);
53b6e3b2164c580 Michael Hennerich 2022-09-13 82 u16 val;
53b6e3b2164c580 Michael Hennerich 2022-09-13 83 int ret;
56ca9db862bf3d7 Paul Cercueil 2016-04-05 84
53b6e3b2164c580 Michael Hennerich 2022-09-13 85 ret = ad5593r_read_word(i2c, AD5593R_MODE_GPIO_READBACK, &val);
56ca9db862bf3d7 Paul Cercueil 2016-04-05 86
56ca9db862bf3d7 Paul Cercueil 2016-04-05 @87 *value = (u8) val;


In the original code the error checking prevented reading uninitialized
variables. It's not really a problem, because ad5593r_read_word() can't
actually fail but, you know? Technically the checker is correct.

56ca9db862bf3d7 Paul Cercueil 2016-04-05 88
53b6e3b2164c580 Michael Hennerich 2022-09-13 89 return ret;
56ca9db862bf3d7 Paul Cercueil 2016-04-05 90 }


2022-09-16 07:14:29

by Nuno Sa

[permalink] [raw]
Subject: RE: [jic23-iio:testing 149/150] drivers/iio/dac/ad5593r.c:87 ad5593r_gpio_read() error: uninitialized symbol 'val'.

Hi Dan,

> From: Dan Carpenter <[email protected]>
> Sent: Friday, September 16, 2022 8:56 AM
> To: [email protected]; Hennerich, Michael
> <[email protected]>
> Cc: [email protected]; [email protected]; [email protected];
> Jonathan Cameron <[email protected]>; Sa, Nuno
> <[email protected]>
> Subject: [jic23-iio:testing 149/150] drivers/iio/dac/ad5593r.c:87
> ad5593r_gpio_read() error: uninitialized symbol 'val'.
>
> [External]
>
> tree:
> https://urldefense.com/v3/__https://git.kernel.org/pub/scm/linux/kernel/g
> it/jic23/iio.git__;!!A3Ni8CS0y2Y!94Jf_eIoy5zwbmsSRdWgugxbqkbgHFd0A88T
> z4SKRufGLX24YYSEzKlB13AXeYzsBWzd5HW-SqPpIzc8hvh-6w$ testing
> head: 62a6e699f4669b2c51f408273756f93b21c9f1a1
> commit: 53b6e3b2164c5807669fbf6b3df0e1494b4d03b8 [149/150] iio: dac:
> ad5593r: Fix i2c read protocol requirements
> config: x86_64-randconfig-m001
> compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
>
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <[email protected]>
> Reported-by: Dan Carpenter <[email protected]>
>
> smatch warnings:
> drivers/iio/dac/ad5593r.c:87 ad5593r_gpio_read() error: uninitialized symbol
> 'val'.
>
> vim +/val +87 drivers/iio/dac/ad5593r.c
>
> 56ca9db862bf3d7 Paul Cercueil 2016-04-05 79 static int
> ad5593r_gpio_read(struct ad5592r_state *st, u8 *value)
> 56ca9db862bf3d7 Paul Cercueil 2016-04-05 80 {
> 56ca9db862bf3d7 Paul Cercueil 2016-04-05 81 struct i2c_client *i2c =
> to_i2c_client(st->dev);
> 53b6e3b2164c580 Michael Hennerich 2022-09-13 82 u16 val;
> 53b6e3b2164c580 Michael Hennerich 2022-09-13 83 int ret;
> 56ca9db862bf3d7 Paul Cercueil 2016-04-05 84
> 53b6e3b2164c580 Michael Hennerich 2022-09-13 85 ret =
> ad5593r_read_word(i2c, AD5593R_MODE_GPIO_READBACK, &val);
> 56ca9db862bf3d7 Paul Cercueil 2016-04-05 86
> 56ca9db862bf3d7 Paul Cercueil 2016-04-05 @87 *value = (u8) val;
>
>
> In the original code the error checking prevented reading uninitialized
> variables. It's not really a problem, because ad5593r_read_word() can't
> actually fail but, you know? Technically the checker is correct.

Hmm, in theory, it can if one of the i2c functions (for some reason) return error.
Not sure how to handle this... Given this is still in the testing branch should I
just re-spin another version of the series? Jonathan?

- Nuno S?

2022-09-16 08:52:55

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [jic23-iio:testing 149/150] drivers/iio/dac/ad5593r.c:87 ad5593r_gpio_read() error: uninitialized symbol 'val'.

On Fri, 16 Sep 2022 07:11:54 +0000
"Sa, Nuno" <[email protected]> wrote:

> Hi Dan,
>
> > From: Dan Carpenter <[email protected]>
> > Sent: Friday, September 16, 2022 8:56 AM
> > To: [email protected]; Hennerich, Michael
> > <[email protected]>
> > Cc: [email protected]; [email protected]; [email protected];
> > Jonathan Cameron <[email protected]>; Sa, Nuno
> > <[email protected]>
> > Subject: [jic23-iio:testing 149/150] drivers/iio/dac/ad5593r.c:87
> > ad5593r_gpio_read() error: uninitialized symbol 'val'.
> >
> > [External]
> >
> > tree:
> > https://urldefense.com/v3/__https://git.kernel.org/pub/scm/linux/kernel/g
> > it/jic23/iio.git__;!!A3Ni8CS0y2Y!94Jf_eIoy5zwbmsSRdWgugxbqkbgHFd0A88T
> > z4SKRufGLX24YYSEzKlB13AXeYzsBWzd5HW-SqPpIzc8hvh-6w$ testing
> > head: 62a6e699f4669b2c51f408273756f93b21c9f1a1
> > commit: 53b6e3b2164c5807669fbf6b3df0e1494b4d03b8 [149/150] iio: dac:
> > ad5593r: Fix i2c read protocol requirements
> > config: x86_64-randconfig-m001
> > compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
> >
> > If you fix the issue, kindly add following tag where applicable
> > Reported-by: kernel test robot <[email protected]>
> > Reported-by: Dan Carpenter <[email protected]>
> >
> > smatch warnings:
> > drivers/iio/dac/ad5593r.c:87 ad5593r_gpio_read() error: uninitialized symbol
> > 'val'.
> >
> > vim +/val +87 drivers/iio/dac/ad5593r.c
> >
> > 56ca9db862bf3d7 Paul Cercueil 2016-04-05 79 static int
> > ad5593r_gpio_read(struct ad5592r_state *st, u8 *value)
> > 56ca9db862bf3d7 Paul Cercueil 2016-04-05 80 {
> > 56ca9db862bf3d7 Paul Cercueil 2016-04-05 81 struct i2c_client *i2c =
> > to_i2c_client(st->dev);
> > 53b6e3b2164c580 Michael Hennerich 2022-09-13 82 u16 val;
> > 53b6e3b2164c580 Michael Hennerich 2022-09-13 83 int ret;
> > 56ca9db862bf3d7 Paul Cercueil 2016-04-05 84
> > 53b6e3b2164c580 Michael Hennerich 2022-09-13 85 ret =
> > ad5593r_read_word(i2c, AD5593R_MODE_GPIO_READBACK, &val);
> > 56ca9db862bf3d7 Paul Cercueil 2016-04-05 86
> > 56ca9db862bf3d7 Paul Cercueil 2016-04-05 @87 *value = (u8) val;
> >
> >
> > In the original code the error checking prevented reading uninitialized
> > variables. It's not really a problem, because ad5593r_read_word() can't
> > actually fail but, you know? Technically the checker is correct.
>
> Hmm, in theory, it can if one of the i2c functions (for some reason) return error.
> Not sure how to handle this... Given this is still in the testing branch should I
> just re-spin another version of the series? Jonathan?

Either a fix patch or a respin is fine as long as I haven't pushed it out as togreg
(once that happens I would almost always want a fix on top).

Separate fix is slightly easier for me.

Jonathan

>
> - Nuno S?

2022-09-16 09:19:06

by Nuno Sa

[permalink] [raw]
Subject: RE: [jic23-iio:testing 149/150] drivers/iio/dac/ad5593r.c:87 ad5593r_gpio_read() error: uninitialized symbol 'val'.



> -----Original Message-----
> From: Jonathan Cameron <[email protected]>
> Sent: Friday, September 16, 2022 10:39 AM
> To: Sa, Nuno <[email protected]>
> Cc: Dan Carpenter <[email protected]>; [email protected];
> Hennerich, Michael <[email protected]>; [email protected];
> [email protected]; [email protected]
> Subject: Re: [jic23-iio:testing 149/150] drivers/iio/dac/ad5593r.c:87
> ad5593r_gpio_read() error: uninitialized symbol 'val'.
>
> [External]
>
> On Fri, 16 Sep 2022 07:11:54 +0000
> "Sa, Nuno" <[email protected]> wrote:
>
> > Hi Dan,
> >
> > > From: Dan Carpenter <[email protected]>
> > > Sent: Friday, September 16, 2022 8:56 AM
> > > To: [email protected]; Hennerich, Michael
> > > <[email protected]>
> > > Cc: [email protected]; [email protected]; [email protected];
> > > Jonathan Cameron <[email protected]>; Sa, Nuno
> > > <[email protected]>
> > > Subject: [jic23-iio:testing 149/150] drivers/iio/dac/ad5593r.c:87
> > > ad5593r_gpio_read() error: uninitialized symbol 'val'.
> > >
> > > [External]
> > >
> > > tree:
> > >
> https://urldefense.com/v3/__https://git.kernel.org/pub/scm/linux/kernel/g
> > >
> it/jic23/iio.git__;!!A3Ni8CS0y2Y!94Jf_eIoy5zwbmsSRdWgugxbqkbgHFd0A88T
> > > z4SKRufGLX24YYSEzKlB13AXeYzsBWzd5HW-SqPpIzc8hvh-6w$ testing
> > > head: 62a6e699f4669b2c51f408273756f93b21c9f1a1
> > > commit: 53b6e3b2164c5807669fbf6b3df0e1494b4d03b8 [149/150] iio: dac:
> > > ad5593r: Fix i2c read protocol requirements
> > > config: x86_64-randconfig-m001
> > > compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
> > >
> > > If you fix the issue, kindly add following tag where applicable
> > > Reported-by: kernel test robot <[email protected]>
> > > Reported-by: Dan Carpenter <[email protected]>
> > >
> > > smatch warnings:
> > > drivers/iio/dac/ad5593r.c:87 ad5593r_gpio_read() error: uninitialized
> symbol
> > > 'val'.
> > >
> > > vim +/val +87 drivers/iio/dac/ad5593r.c
> > >
> > > 56ca9db862bf3d7 Paul Cercueil 2016-04-05 79 static int
> > > ad5593r_gpio_read(struct ad5592r_state *st, u8 *value)
> > > 56ca9db862bf3d7 Paul Cercueil 2016-04-05 80 {
> > > 56ca9db862bf3d7 Paul Cercueil 2016-04-05 81 struct i2c_client *i2c =
> > > to_i2c_client(st->dev);
> > > 53b6e3b2164c580 Michael Hennerich 2022-09-13 82 u16 val;
> > > 53b6e3b2164c580 Michael Hennerich 2022-09-13 83 int ret;
> > > 56ca9db862bf3d7 Paul Cercueil 2016-04-05 84
> > > 53b6e3b2164c580 Michael Hennerich 2022-09-13 85 ret =
> > > ad5593r_read_word(i2c, AD5593R_MODE_GPIO_READBACK, &val);
> > > 56ca9db862bf3d7 Paul Cercueil 2016-04-05 86
> > > 56ca9db862bf3d7 Paul Cercueil 2016-04-05 @87 *value = (u8) val;
> > >
> > >
> > > In the original code the error checking prevented reading uninitialized
> > > variables. It's not really a problem, because ad5593r_read_word() can't
> > > actually fail but, you know? Technically the checker is correct.
> >
> > Hmm, in theory, it can if one of the i2c functions (for some reason) return
> error.
> > Not sure how to handle this... Given this is still in the testing branch should I
> > just re-spin another version of the series? Jonathan?
>
> Either a fix patch or a respin is fine as long as I haven't pushed it out as togreg
> (once that happens I would almost always want a fix on top).
>
> Separate fix is slightly easier for me.
>

fix it is...

- Nuno S?