lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aIeDDsRurrgXqRQn@bhairav-test.ee.iitb.ac.in>
Date: Mon, 28 Jul 2025 19:32:54 +0530
From: Akhilesh Patil <akhilesh@...iitb.ac.in>
To: Greg KH <gregkh@...uxfoundation.org>
Cc: lars@...afoo.de, Michael.Hennerich@...log.com, jic23@...nel.org,
	dlechner@...libre.com, nuno.sa@...log.com, andy@...nel.org,
	marcelo.schmitt1@...il.com, gshahrouzi@...il.com,
	hridesh699@...il.com, linux-iio@...r.kernel.org,
	linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org,
	akhileshpatilvnit@...il.com, skhan@...uxfoundation.org
Subject: Re: [PATCH] staging: iio: ad5933: Fix implicit fall-through in
 switch()

On Mon, Jul 28, 2025 at 12:39:21PM +0200, Greg KH wrote:
> On Mon, Jul 28, 2025 at 03:29:28PM +0530, Akhilesh Patil wrote:
> > Add default case in switch() codeblock in ad5933_read_raw().
> > Convert implicit error return due to switch fallthrough to explicit return
> > to make intent clear. Follow kernel switch fall-thorugh guidelines at
> > Documentation/process/deprecated.rst
> > 
> > Signed-off-by: Akhilesh Patil <akhilesh@...iitb.ac.in>
> > ---
> > Checked build for 6.16.0 kernel with ad5933
> > ---
> >  drivers/staging/iio/impedance-analyzer/ad5933.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c
> > index 85a4223295cd..6547a259b8a0 100644
> > --- a/drivers/staging/iio/impedance-analyzer/ad5933.c
> > +++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
> > @@ -533,9 +533,10 @@ static int ad5933_read_raw(struct iio_dev *indio_dev,
> >  		*val = 1000;
> >  		*val2 = 5;
> >  		return IIO_VAL_FRACTIONAL_LOG2;
> > +	default:
> > +		return -EINVAL;
> 
> What tool is requiring this to be added?  It's totally redundant and
> needs to have the tool fixed instead.

This patch is not inspired by any tool as such.
I observed this code pattern while manually reading the staging area iio
code. From my eyes, there is implicit intention to return from switch block if
no match is found which can be improved in readibility by explicit
default block returning error.
I agree this is redundant and will not have any functional impact.
However, imo - this can help support kernel wide efforts to
clarify switch() blocks.

The motivation for this patch is from a035d552 which talks about
eleminating ambiguity by clearly defining swich() case blocks.

Thanks for the review, 

Akhilesh

> 
> sorry,
> 
> greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ