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:	Fri, 22 Feb 2008 21:58:52 +0200
From:	Adrian Bunk <bunk@...nel.org>
To:	Alan Cox <alan@...rguk.ukuu.org.uk>
Cc:	Ray Lee <ray-lk@...rabbit.org>, Greg KH <gregkh@...e.de>,
	linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [2.6 patch] usb/serial/io_ti.c: remove unneeded NULL check

On Fri, Feb 22, 2008 at 10:10:16AM +0000, Alan Cox wrote:
> > Either the test of port->tty here is unneeded:
> > 
> >  if (port->tty)
> >                port->tty->low_latency = low_latency;
> > 
> > ...or the lack of test of port->tty here is a mistake:
> > 
> > 	 edge_set_termios (port, port->tty->termios);
> 
> Interesting - so coverity doesn't understand the BKL. It's producing the
> right answer, for the right reason but the assumption it makes isn't 100%
> safe.

Coverity doesn't perform magic.
It simply notices that it's once checked and once dereferenced 
unconditionally.

> The check can go.

Thanks, patch below.

> Alan

cu
Adrian


<--  snip  -->


There's no reason for checking pdev->bus for being NULL here (and we'd 
anyway Oops below if it was).

Signed-off-by: Adrian Bunk <bunk@...nel.org>

---
afefd6935c788b3e4071092ebc04c4d356dd7496 diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index cd34059..700683c 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -1944,8 +1944,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp)
 	if (edge_port == NULL)
 		return -ENODEV;
 
-	if (port->tty)
-		port->tty->low_latency = low_latency;
+	port->tty->low_latency = low_latency;
 
 	port_number = port->number - port->serial->minor;
 	switch (port_number) {

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ