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/qpmouse.c resource allocation fixes
Hi,

Please take a look and consider applying.

- Arnaldo

--- linux-2.4.0-test7-pre3/drivers/char/qpmouse.c Thu Jul 13 01:58:42 2000
+++ linux-2.4.0-test7-pre3.acme/drivers/char/qpmouse.c Mon Aug 14 17:35:36 2000
@@ -21,6 +21,9 @@
* Rearranged SIGIO support to use code from tty_io. 9Sept95 ctm@ardi.com
*
* Modularised 8-Sep-95 Philip Blundell <pjb27@cam.ac.uk>
+ *
+ * Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 08/14/2000
+ * - check resource allocation in qpmouse_init
*/

#include <linux/module.h>
@@ -339,14 +342,27 @@

int __init qpmouse_init(void)
{
+ int ret;
+
if (!probe_qp())
return -EIO;

+ queue = (struct qp_queue *) kmalloc(sizeof(*queue), GFP_KERNEL);
+
+ if (!queue)
+ return -ENOMEM;
+
+ ret = misc_register(&qp_mouse);
+
+ if (ret) {
+ kfree(queue);
+ return ret;
+ }
+
printk(KERN_INFO "82C710 type pointing device detected -- driver installed.\n");
/* printk("82C710 address = %x (should be 0x310)\n", qp_data); */
qp_present = 1;
- misc_register(&qp_mouse);
- queue = (struct qp_queue *) kmalloc(sizeof(*queue), GFP_KERNEL);
+
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.063 / U:0.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site