* [PATCH] iio: cdc: ad7746: Suppress false uninitialized value warning.
@ 2022-08-30 18:33 Jonathan Cameron
2022-08-30 20:04 ` Andy Shevchenko
0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Cameron @ 2022-08-30 18:33 UTC (permalink / raw)
To: linux-iio; +Cc: Jonathan Cameron
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Fix warning:
drivers/iio/cdc/ad7746.c:336:14: warning: use of uninitialized value '<unknown>' [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
reported on linux-next. The compiler can't see into the implementation
of kstrtobool() to identify that the if (ret < 0) condition is
sufficient to detect cases where this parameter is not initialized.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
drivers/iio/cdc/ad7746.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/cdc/ad7746.c b/drivers/iio/cdc/ad7746.c
index b266f5328140..5a3863bcaac9 100644
--- a/drivers/iio/cdc/ad7746.c
+++ b/drivers/iio/cdc/ad7746.c
@@ -333,7 +333,7 @@ static inline ssize_t ad7746_start_calib(struct device *dev,
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct ad7746_chip_info *chip = iio_priv(indio_dev);
int ret, timeout = 10;
- bool doit;
+ bool doit = false;
ret = kstrtobool(buf, &doit);
if (ret < 0)
--
2.37.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] iio: cdc: ad7746: Suppress false uninitialized value warning.
2022-08-30 18:33 [PATCH] iio: cdc: ad7746: Suppress false uninitialized value warning Jonathan Cameron
@ 2022-08-30 20:04 ` Andy Shevchenko
2022-09-04 15:53 ` Jonathan Cameron
0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2022-08-30 20:04 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: linux-iio, Jonathan Cameron
On Tue, Aug 30, 2022 at 10:10 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> Fix warning:
> drivers/iio/cdc/ad7746.c:336:14: warning: use of uninitialized value '<unknown>' [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
> reported on linux-next. The compiler can't see into the implementation
> of kstrtobool() to identify that the if (ret < 0) condition is
> sufficient to detect cases where this parameter is not initialized.
Sorry, but to me this sounds like a false positive that provokes
developer to add not only unneeded, but in some cases harmful code
(yes, there were cases in the history when preinitializing variable
with some value made a regression).
NAK from me (but you always may overrule as a maintainer :-).
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iio: cdc: ad7746: Suppress false uninitialized value warning.
2022-08-30 20:04 ` Andy Shevchenko
@ 2022-09-04 15:53 ` Jonathan Cameron
0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2022-09-04 15:53 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: linux-iio, Jonathan Cameron
On Tue, 30 Aug 2022 23:04:47 +0300
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> On Tue, Aug 30, 2022 at 10:10 PM Jonathan Cameron <jic23@kernel.org> wrote:
> >
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> > Fix warning:
> > drivers/iio/cdc/ad7746.c:336:14: warning: use of uninitialized value '<unknown>' [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
> > reported on linux-next. The compiler can't see into the implementation
> > of kstrtobool() to identify that the if (ret < 0) condition is
> > sufficient to detect cases where this parameter is not initialized.
>
> Sorry, but to me this sounds like a false positive that provokes
> developer to add not only unneeded, but in some cases harmful code
> (yes, there were cases in the history when preinitializing variable
> with some value made a regression).
> NAK from me (but you always may overrule as a maintainer :-).
>
I'm fine leaving it as is and exercising the delete key for any reports :)
Jonathan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-09-04 16:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-30 18:33 [PATCH] iio: cdc: ad7746: Suppress false uninitialized value warning Jonathan Cameron
2022-08-30 20:04 ` Andy Shevchenko
2022-09-04 15:53 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox