Re: [PATCH] Driver Core patches for 2.6.6

Greg KH
2004-05-14T23:28:44Z

ChangeSet 1.1587.5.20, 2004/05/05 14:40:43-07:00, greg@kroah.com

Driver core: handle error if we run out of memory in kmap code

drivers/base/map.c | 7 +++++++
1 files changed, 7 insertions(+)

diff -Nru a/drivers/base/map.c b/drivers/base/map.c
--- a/drivers/base/map.c Fri May 14 15:57:59 2004
+++ b/drivers/base/map.c Fri May 14 15:57:59 2004
@@ -138,6 +138,13 @@
struct kobj_map *p = kmalloc(sizeof(struct kobj_map), GFP_KERNEL);
struct probe *base = kmalloc(sizeof(struct probe), GFP_KERNEL);
int i;
+
+ if ((p == NULL) || (base == NULL)) {
+ kfree(p);
+ kfree(base);
+ return NULL;
+ }
+
memset(base, 0, sizeof(struct probe));
base->dev = 1;
base->range = ~0;