lkml.org 
[lkml]   [2000]   [Aug]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] drivers/char/pc_keyb.c: checking resource allocation
Linus,

Please take a look and consider applying.

- Arnaldo


--- linux-2.4.0-test7-pre3/drivers/char/pc_keyb.c Thu Jul 13 01:58:42 2000
+++ linux-2.4.0-test7-pre3.acme/drivers/char/pc_keyb.c Mon Aug 14 13:43:20 2000
@@ -13,6 +13,9 @@
* Code fixes to handle mouse ACKs properly.
* C. Scott Ananian <cananian@alumni.princeton.edu> 1999-01-29.
*
+ * Check resource allocation in psaux_init
+ * Arnaldo Carvalho de Melo <acme@conectiva.com.br> 2000-08-14
+ *
*/

#include <linux/config.h>
@@ -1007,11 +1010,23 @@

static int __init psaux_init(void)
{
+ int ret;
+
if (!detect_auxiliary_port())
return -EIO;

- misc_register(&psaux_mouse);
queue = (struct aux_queue *) kmalloc(sizeof(*queue), GFP_KERNEL);
+
+ if (!queue)
+ return -ENOMEM;
+
+ ret = misc_register(&psaux_mouse);
+
+ if (ret)
+ kfree(queue);
+ return ret;
+ }
+
memset(queue, 0, sizeof(*queue));
queue->head = queue->tail = 0;
init_waitqueue_head(&queue->proc_list);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:58    [W:0.277 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site