Patch "serial: sh-sci: Uninitialized variables in sysfs files" has been added to the 4.12-stable tree
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 the 4.12-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
serial-sh-sci-uninitialized-variables-in-sysfs-files.patch
and it can be found in the queue-4.12 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
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
From: Dan Carpenter <[email protected]>
commit 4ab3c51e0540ba8464fe34d84cc35821bb77ae92 upstream.
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 d {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(str {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 )
Patches currently in stable-queue which might be from [email protected] are
queue-4.12/serial-st-asc-potential-error-pointer-dereference.patch queue-4.12/ipmi-ssif-add-missing-unlock-in-error-branch.patch queue-4.12/serial-sh-sci-uninitialized-variables-in-sysfs-files.patch