YOSHIFUJI Hideaki / 吉藤英明 wrote:
> In article <[email protected]> (at Wed, 11 Jul 2007 16:55:29 -0700), Greg KH <[email protected]> says:
>
>> On Thu, Jul 12, 2007 at 08:50:47AM +0900, YOSHIFUJI Hideaki / ?$B5HF#1QL@ wrote:
>>> In article <[email protected]> (at Wed, 11 Jul 2007 16:31:43 -0700), Greg Kroah-Hartman <[email protected]> says:
>>>
>>>> Make sysfs_put() ignore NULL sd instead of oopsing.
>>> I do not think this is a good idea; it is non-sense (and rather a bug)
>>> to call "put" with NULL argument in general.
>> It's better than having to check it all the time in the caller :)
>
> How many callers do we have that will get benefit from this change?
>
> Well, the change will hide the bug. It seems all callers in fs/sysfs
> already assume that the argument is NOT NULL, and it is a bug to call
> sysfs_put() with NULL; the function should be used to "put" something
> you "have" (non-NULL). If it is called with NULL, I would say, we
> should BUG here to detect the logical bug.
Well, I'm okay either way. It's not like one way is undisputably better
than the other but we're leaning toward accepting NULL argument in this
type of functions. Think about kfree(NULL) and its usefulness. More
importantly, the ecosystem around sysfs - that is, kobject, driver model
- generally accepts NULL argument for their get/put functions, so unless
there's a compelling reason to convert them all, and I don't see any,
sysfs_put() needs to follow the same rule.
--
tejun
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]