Commit 4b4b9463 authored by Dave Jones's avatar Dave Jones

[PATCH] i2c-proc wasn't checking kmalloc result

parent 711263df
...@@ -119,6 +119,10 @@ int i2c_create_name(char **name, const char *prefix, ...@@ -119,6 +119,10 @@ int i2c_create_name(char **name, const char *prefix,
sprintf(name_buffer, "%s-i2c-%d-%02x", prefix, id, addr); sprintf(name_buffer, "%s-i2c-%d-%02x", prefix, id, addr);
} }
*name = kmalloc(strlen(name_buffer) + 1, GFP_KERNEL); *name = kmalloc(strlen(name_buffer) + 1, GFP_KERNEL);
if (!*name) {
printk (KERN_WARNING "i2c_create_name: not enough memory\n");
return -ENOMEM;
}
strcpy(*name, name_buffer); strcpy(*name, name_buffer);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment