Linux SCSI subsystem development
 help / color / mirror / Atom feed
* kobject_register needs return value checks (was: What protection does sysfs_readdir have with SMP/Preemption?)
       [not found]           ` <1132755654.13395.37.camel@localhost.localdomain>
@ 2005-11-23 15:24             ` Steven Rostedt
  0 siblings, 0 replies; only message in thread
From: Steven Rostedt @ 2005-11-23 15:24 UTC (permalink / raw)
  To: maneesh
  Cc: Thibaut VARENE, linux-scsi, linuxraid, Matt Tolentino, len.brown,
	Ingo Molnar, LKML, Greg KH

I'm doing some tests to see what happens on a failure of setting up
something in the sysfs, and I've discovered a few areas that don't test
the return value of kobject_register. The test was due to a memory
problem in a custom kernel that showed that sysfs didn't quite handle
the error cases well.

I did the following command:

find .  -name "*.c" ! -type d  | xargs grep  "kobject_register"

I found 27 hits. Of these:

14 - checked the return value.
1 - reference in .mod.c file /* ignore it */
3 - in comments /* ignore it */
1 - declaration of actual function /* ignore it */
1 - EXPORT_SYMBOL /* ignore it */
1 - inside a printk quote. /* ignore it */

and ...

6 - calls without checking return values.

Here are the culprits:

./drivers/acpi/scan.c:  kobject_register(&device->kobj);
./drivers/firmware/efivars.c:   kobject_register(&new_efivar->kobj);
./drivers/md/md.c:      kobject_register(&mddev->kobj);
./drivers/parisc/pdc_stable.c:          kobject_register(&entry->kobj);
./fs/partitions/check.c:        kobject_register(&p->kobj);
./kernel/params.c:      kobject_register(&mk->kobj);


Normally, these would not return errors, but in case they do, the kernel
should be robust enough to handle it.

I tried to CC all the maintainers of the above files.

-- Steve

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-11-23 15:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1132695202.13395.15.camel@localhost.localdomain>
     [not found] ` <20051122213947.GB8575@kroah.com>
     [not found]   ` <20051123045049.GA22714@in.ibm.com>
     [not found]     ` <Pine.LNX.4.58.0511230748000.23751@gandalf.stny.rr.com>
     [not found]       ` <20051123135847.GF22714@in.ibm.com>
     [not found]         ` <1132755344.13395.32.camel@localhost.localdomain>
     [not found]           ` <1132755654.13395.37.camel@localhost.localdomain>
2005-11-23 15:24             ` kobject_register needs return value checks (was: What protection does sysfs_readdir have with SMP/Preemption?) Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox