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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 3 Aug 2020 22:12:09 +0200
From:   Sam Ravnborg <sam@...nborg.org>
To:     Joe Perches <joe@...ches.com>
Cc:     "Gustavo A. R. Silva" <gustavoars@...nel.org>,
        Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
        Nicolas Ferre <nicolas.ferre@...rochip.com>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        Ludovic Desroches <ludovic.desroches@...rochip.com>,
        Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        Timur Tabi <timur@...nel.org>,
        Jingoo Han <jingoohan1@...il.com>,
        Antonino Daplas <adaplas@...il.com>,
        linux-fbdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        dri-devel@...ts.freedesktop.org, linux-omap@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH][next] fbdev: Use fallthrough pseudo-keyword

On Mon, Aug 03, 2020 at 12:52:40PM -0700, Joe Perches wrote:
> On Mon, 2020-08-03 at 21:41 +0200, Sam Ravnborg wrote:
> > On Tue, Jul 07, 2020 at 04:05:39PM -0500, Gustavo A. R. Silva wrote:
> > > Replace the existing /* fall through */ comments and its variants with
> > > the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
> > > fall-through markings when it is the case.
> > > 
> > > [1] https://www.kernel.org/doc/html/latest/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through
> > > 
> > > Signed-off-by: Gustavo A. R. Silva <gustavoars@...nel.org>
> > 
> > Thanks.
> > 
> > Fixed indent in arcfb.c while applying.
> > Applied to drm-misc-next and it will appear in 5.10
> 
> Perhaps better would be to fix all the switch / case
> brace uses so that it looks more typical kernel style.

falltrhough seems like an OK thing to do even if fbdev is in pure
maintenance mode. Mostly so tools do not stumble upon this and
we continue to see patches.

But larger refactorings seems a little pointless.

If we do this change, should we then also start to accept indent fixes
for the other switch () cases in the fbdev drivers.

My initial reaction is therefore thanks, but no thanks.

	Sam

> 
> > > diff --git a/drivers/video/fbdev/arcfb.c b/drivers/video/fbdev/arcfb.c
> > > index 6f7838979f0a..ae3d8e8b8d33 100644
> > > --- a/drivers/video/fbdev/arcfb.c
> > > +++ b/drivers/video/fbdev/arcfb.c
> > > @@ -419,7 +419,7 @@ static int arcfb_ioctl(struct fb_info *info,
> > >  			schedule();
> > >  			finish_wait(&arcfb_waitq, &wait);
> > >  		}
> > > -		/* fall through */
> > > +			fallthrough;
> > >  
> > >  		case FBIO_GETCONTROL2:
> > >  		{
> 
> ---
>  drivers/video/fbdev/arcfb.c | 52 ++++++++++++++++++++++-----------------------
>  1 file changed, 25 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/video/fbdev/arcfb.c b/drivers/video/fbdev/arcfb.c
> index 6f7838979f0a..4419655e3e58 100644
> --- a/drivers/video/fbdev/arcfb.c
> +++ b/drivers/video/fbdev/arcfb.c
> @@ -403,35 +403,33 @@ static int arcfb_ioctl(struct fb_info *info,
>  	unsigned long flags;
>  
>  	switch (cmd) {
> -		case FBIO_WAITEVENT:
> -		{
> -			DEFINE_WAIT(wait);
> -			/* illegal to wait on arc if no irq will occur */
> -			if (!par->irq)
> -				return -EINVAL;
> -
> -			/* wait until the Arc has generated an interrupt
> -			 * which will wake us up */
> -			spin_lock_irqsave(&par->lock, flags);
> -			prepare_to_wait(&arcfb_waitq, &wait,
> -					TASK_INTERRUPTIBLE);
> -			spin_unlock_irqrestore(&par->lock, flags);
> -			schedule();
> -			finish_wait(&arcfb_waitq, &wait);
> -		}
> -		/* fall through */
> +	case FBIO_WAITEVENT: {
> +		DEFINE_WAIT(wait);
> +		/* illegal to wait on arc if no irq will occur */
> +		if (!par->irq)
> +			return -EINVAL;
>  
> -		case FBIO_GETCONTROL2:
> -		{
> -			unsigned char ctl2;
> +		/* wait until the Arc has generated an interrupt
> +		 * which will wake us up */
> +		spin_lock_irqsave(&par->lock, flags);
> +		prepare_to_wait(&arcfb_waitq, &wait, TASK_INTERRUPTIBLE);
> +		spin_unlock_irqrestore(&par->lock, flags);
> +		schedule();
> +		finish_wait(&arcfb_waitq, &wait);
> +		fallthrough;
> +	}
>  
> -			ctl2 = ks108_readb_ctl2(info->par);
> -			if (copy_to_user(argp, &ctl2, sizeof(ctl2)))
> -				return -EFAULT;
> -			return 0;
> -		}
> -		default:
> -			return -EINVAL;
> +	case FBIO_GETCONTROL2: {
> +		unsigned char ctl2;
> +
> +		ctl2 = ks108_readb_ctl2(info->par);
> +		if (copy_to_user(argp, &ctl2, sizeof(ctl2)))
> +			return -EFAULT;
> +		return 0;
> +	}
> +
> +	default:
> +		return -EINVAL;
>  	}
>  }
>  
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ