aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tty_ioctl.c
diff options
context:
space:
mode:
authorKAMBAROV, ZAUR <kambarov@berkeley.edu>2005-06-28 23:45:12 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-29 00:20:34 -0400
commit69f63c5c34d0b34ee2cbf10c5ff7fcff0404879e (patch)
tree1023d240c44cc2a137c9cca4b6c015e584e30356 /drivers/char/tty_ioctl.c
parentc7f1721ef284c6e8257c7471a02148db76105036 (diff)
[PATCH] coverity: tty_ldisc_ref return null check
We add a check of the return value of tty_ldisc_ref(), which is checked 7 out of 8 times, e.g.: 149 ld = tty_ldisc_ref(tty); 150 if (ld != NULL) { 151 if (ld->set_termios) 152 (ld->set_termios)(tty, &old_termios); 153 tty_ldisc_deref(ld); 154 } This defect was found automatically by Coverity Prevent, a static analysis tool. (akpm: presumably `ld' is never NULL. Oh well) Signed-off-by: Zaur Kambarov <zkambarov@coverity.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/tty_ioctl.c')
-rw-r--r--drivers/char/tty_ioctl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c
index 58597993954f..f19cf9d7792d 100644
--- a/drivers/char/tty_ioctl.c
+++ b/drivers/char/tty_ioctl.c
@@ -476,11 +476,11 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file,
476 ld = tty_ldisc_ref(tty); 476 ld = tty_ldisc_ref(tty);
477 switch (arg) { 477 switch (arg) {
478 case TCIFLUSH: 478 case TCIFLUSH:
479 if (ld->flush_buffer) 479 if (ld && ld->flush_buffer)
480 ld->flush_buffer(tty); 480 ld->flush_buffer(tty);
481 break; 481 break;
482 case TCIOFLUSH: 482 case TCIOFLUSH:
483 if (ld->flush_buffer) 483 if (ld && ld->flush_buffer)
484 ld->flush_buffer(tty); 484 ld->flush_buffer(tty);
485 /* fall through */ 485 /* fall through */
486 case TCOFLUSH: 486 case TCOFLUSH: