On Wed, Jul 22, 2015 at 09:09:06PM +0300, Dmitry Kalinkin wrote: > + for (level = 1; level <= 7; level++) { > + char *level_node_name = kasprintf(GFP_KERNEL, "%d", level); > + struct kobject *level_node = kobject_create_and_add( > + level_node_name, kobj); > + if (!level_node) > + return -ENOMEM; >From the zero day testing results, what I've noticed is that allocations in the initializer are more error prone. You should be testing the results from kasprintf() and there is a leak if the "level_node" allocation fails. char *level_node_name; struct kobject *level_node; level_node_name = kasprintf(GFP_KERNEL, "%d", level); if (!level_node_name) return -ENOMEM; level_node = kobject_create_and_add(level_node_name, kobj); if (!level_node) { kfree(level_node_name); return -ENOMEM; } The other advantage to writing it like this is that you don't run into the 80 char limit. regards, dan carpenter _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel