patch "serial: sh-sci: Uninitialized variables in sysfs files" added to tty-linus
Subsystems (2)
This is a note to let you know that I've just added the patch titled
serial: sh-sci: Uninitialized variables in sysfs files
to my tty git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
in the tty-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
Quoted 1 line
From
4ab3c51e0540ba8464fe34d84cc35821bb77ae92Mon Sep 17 00:00:00 2001
From: Dan Carpenter <[email protected]>
Date: Mon, 17 Jul 2017 11:34:23 +0300
Subject: serial: sh-sci: Uninitialized variables in sysfs files
The kstrtol() function returns -ERANGE as well as -EINVAL so these tests are not enough. It's not a super serious bug, but my static checker correctly complains that the "r" variable might be used uninitialized.
--- drivers/tty/serial/sh-sci.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/tty/serial/sh-sci.c +8 -4
@@ -1085,10 +1085,12 @@ static ssize_t rx_trigger_store(struct device *dev, {struct uart_port *port =dev_get_drvdata (dev);struct sci_port *sci =to_sci_port (port); +int ret;long r; -if (kstrtol (buf,0 , &r) == -EINVAL ) -return -EINVAL ; + ret =kstrtol (buf,0 , &r); +if (ret) +return ret; sci->rx_trigger =scif_set_rtrg (port, r);if (port->type ==PORT_SCIFA || port->type ==PORT_SCIFB )
@@ -1116,10 +1118,12 @@ static ssize_t rx_fifo_timeout_store(struct device *dev, {struct uart_port *port =dev_get_drvdata (dev);struct sci_port *sci =to_sci_port (port); +int ret;long r; -if (kstrtol (buf,0 , &r) == -EINVAL ) -return -EINVAL ; + ret =kstrtol (buf,0 , &r); +if (ret) +return ret; sci->rx_fifo_timeout = r;scif_set_rtrg (port,1 );if (r >0 )
Signature · 1 line
2.13.3