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] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 6 Mar 2023 09:04:56 +0000
From:   Lee Jones <lee@...nel.org>
To:     Jiri Slaby <jirislaby@...nel.org>
Cc:     Florian Eckert <fe@....tdt.de>, u.kleine-koenig@...gutronix.de,
        gregkh@...uxfoundation.org, pavel@....cz,
        linux-kernel@...r.kernel.org, linux-leds@...r.kernel.org,
        Eckert.Florian@...glemail.com
Subject: Re: [PATCH v7 2/2] trigger: ledtrig-tty: add additional modes

On Mon, 06 Mar 2023, Jiri Slaby wrote:

> On 03. 03. 23, 15:11, Lee Jones wrote:
> > On Wed, 22 Feb 2023, Florian Eckert wrote:
> > > @@ -113,21 +207,38 @@ static void ledtrig_tty_work(struct work_struct *work)
> > >   		trigger_data->tty = tty;
> > >   	}
> > > -	ret = tty_get_icount(trigger_data->tty, &icount);
> > > -	if (ret) {
> > > -		dev_info(trigger_data->tty->dev, "Failed to get icount, stopped polling\n");
> > > -		mutex_unlock(&trigger_data->mutex);
> > > -		return;
> > > -	}
> > > -
> > > -	if (icount.rx != trigger_data->rx ||
> > > -	    icount.tx != trigger_data->tx) {
> > > -		led_set_brightness_sync(trigger_data->led_cdev, LED_ON);
> > > -
> > > -		trigger_data->rx = icount.rx;
> > > -		trigger_data->tx = icount.tx;
> > > -	} else {
> > > -		led_set_brightness_sync(trigger_data->led_cdev, LED_OFF);
> > > +	switch (trigger_data->mode) {
> > > +	case TTY_LED_CTS:
> > > +		ledtrig_tty_flags(trigger_data, TIOCM_CTS);
> > > +		break;
> > > +	case TTY_LED_DSR:
> > > +		ledtrig_tty_flags(trigger_data, TIOCM_DSR);
> > > +		break;
> > > +	case TTY_LED_CAR:
> > > +		ledtrig_tty_flags(trigger_data, TIOCM_CAR);
> > > +		break;
> > > +	case TTY_LED_RNG:
> > > +		ledtrig_tty_flags(trigger_data, TIOCM_RNG);
> > > +		break;
> > > +	case TTY_LED_CNT:
> > 
> > I believe this requires a 'fall-through' statement.
> 
> I don't think this is the case. Isn't fallthrough required only in cases
> when there is at least one statement, i.e. a block?

There's no mention of this caveat in the document.

To my untrained eyes, the rule looks fairly explicit, starting with "All".

"
  All switch/case blocks must end in one of:

  * break;
  * fallthrough;
  * continue;
  * goto <label>;
  * return [expression];
"

If you're aware of something I'm not, please consider updating the doc.

> > Documentation/process/deprecated.rst
> > 
> > > +	default:
> > > +		ret = tty_get_icount(trigger_data->tty, &icount);
> > > +		if (ret) {
> > > +			dev_info(trigger_data->tty->dev, "Failed to get icount, stopped polling\n");
> > > +			mutex_unlock(&trigger_data->mutex);
> > > +			return;
> > > +		}
> > > +

-- 
Lee Jones [李琼斯]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ