[PATCH] qtronix missing failure handling

From: Panagiotis Issaris
Date: Sat Mar 05 2005 - 10:12:30 EST


Hi,

The Qtronix keyboard driver doesn't handle the possible failure of memory
allocation.

Signed-off-by: Panagiotis Issaris <panagiotis.issaris@xxxxxxxxxxxxxxxxxxx>

diff -pruN linux-2.6.11-mm1/drivers/char/qtronix.c linux-2.6.11-mm1-pi/drivers/char/qtronix.c
--- linux-2.6.11-mm1/drivers/char/qtronix.c 2005-03-05 15:56:43.000000000 +0100
+++ linux-2.6.11-mm1-pi/drivers/char/qtronix.c 2005-03-05 15:57:22.000000000 +0100
@@ -591,6 +591,11 @@ static int __init psaux_init(void)
return retval;

queue = (struct aux_queue *) kmalloc(sizeof(*queue), GFP_KERNEL);
+ if (!queue) {
+ misc_deregister(&psaux_mouse);
+ return -ENOMEM;
+ }
+
memset(queue, 0, sizeof(*queue));
queue->head = queue->tail = 0;
init_waitqueue_head(&queue->proc_list);
--
K.U.Leuven, Mechanical Eng., Mechatronics & Robotics Research Group
http://people.mech.kuleuven.ac.be/~pissaris/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/