Re: [PATCH 1/4][Trivial] lib/kobject.c: Check parameter inkobject_get_path

From: greg
Date: Mon Apr 23 2012 - 16:38:28 EST


On Sat, Apr 21, 2012 at 05:25:42PM +0800, yan wrote:
> kobject_get_path is exported, it passes its parameter kobj to
> get_kobj_path_length and fill_kobj_path which are both static
> and called only once here. So check this parameter.

Why? If you call this function, you should pass in a valid pointer,
that's the proper way to call it. No need to be "defensive" here at
all, if the caller messes up, then it crashes, as it should not be
making this type of call on a NULL pointer.

In looking at all of the in-kernel users of this function, they all do
this properly, so I see no need for this patch.

And these types of patches are not "trivial" at all, so please don't
mark them as such.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/