[PATCH] SELinux: fix size-128 slab leak
[safe/jmp/linux-2.6] / drivers / char / mxser.c
index d5c34af..ea725a9 100644 (file)
@@ -38,7 +38,6 @@
 
 #include <linux/config.h>
 #include <linux/module.h>
-#include <linux/version.h>
 #include <linux/autoconf.h>
 #include <linux/errno.h>
 #include <linux/signal.h>
@@ -814,7 +813,7 @@ static int mxser_init(void)
 
        /* start finding PCI board here */
 #ifdef CONFIG_PCI
-       n = (sizeof(mxser_pcibrds) / sizeof(mxser_pcibrds[0])) - 1;
+       n = ARRAY_SIZE(mxser_pcibrds) - 1;
        index = 0;
        b = 0;
        while (b < n) {
@@ -917,6 +916,9 @@ static int mxser_open(struct tty_struct *tty, struct file *filp)
        struct mxser_struct *info;
        int retval, line;
 
+       /* initialize driver_data in case something fails */
+       tty->driver_data = NULL;
+
        line = tty->index;
        if (line == MXSER_PORTS)
                return 0;
@@ -979,7 +981,7 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
        if (tty->index == MXSER_PORTS)
                return;
        if (!info)
-               BUG();
+               return;
 
        spin_lock_irqsave(&info->slock, flags);
 
@@ -1980,7 +1982,7 @@ static void mxser_receive_chars(struct mxser_struct *info, int *status)
 
        spin_lock_irqsave(&info->slock, flags);
 
-       recv_room = tty->ldisc.receive_room(tty);
+       recv_room = tty->receive_room;
        if ((recv_room == 0) && (!info->ldisc_stop_rx)) {
                //mxser_throttle(tty);
                mxser_stoprx(tty);