lkml.org 
[lkml]   [2002]   [Sep]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH][2.4.20-ac] check kmalloc return in sis_ds.c
Hi Alan,
Diffed against 2.5.33 but applies clean to 2.4.20-pre4-ac1, i
presumed there would be no point in sending this for 2.5 seeing as that
isn't as current as whats in your tree.

Zwane

Index: linux-2.5.33/drivers/char/drm/sis_ds.c
===================================================================
RCS file: /build/cvsroot/linux-2.5.33/drivers/char/drm/sis_ds.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 sis_ds.c
--- linux-2.5.33/drivers/char/drm/sis_ds.c 31 Aug 2002 22:30:31 -0000 1.1.1.1
+++ linux-2.5.33/drivers/char/drm/sis_ds.c 1 Sep 2002 11:25:53 -0000
@@ -50,15 +50,16 @@
set_t *set;

set = (set_t *)MALLOC(sizeof(set_t));
- for(i = 0; i < SET_SIZE; i++){
- set->list[i].free_next = i+1;
- set->list[i].alloc_next = -1;
- }
- set->list[SET_SIZE-1].free_next = -1;
- set->free = 0;
- set->alloc = -1;
- set->trace = -1;
-
+ if (set) {
+ for(i = 0; i < SET_SIZE; i++){
+ set->list[i].free_next = i+1;
+ set->list[i].alloc_next = -1;
+ }
+ set->list[SET_SIZE-1].free_next = -1;
+ set->free = 0;
+ set->alloc = -1;
+ set->trace = -1;
+ }
return set;
}

@@ -172,7 +173,8 @@
{
void *addr;
addr = kmalloc(nmemb*size, GFP_KERNEL);
- memset(addr, 0, nmemb*size);
+ if (addr)
+ memset(addr, 0, nmemb*size);
return addr;
}
#define free(n) kfree(n)
--
function.linuxpower.ca

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

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