lkml.org 
[lkml]   [2004]   [Mar]   [14]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateSat, 13 Mar 2004 18:55:04 -0800
FromGreg KH <>
SubjectRe: [RFC] kref, a tiny, sane, reference count object
On Sat, Mar 13, 2004 at 04:34:51PM -0800, Andrew Morton wrote:
> > +struct kref * kref_get(struct kref *kref)
> > +{
> > +	if (kref) {
> > +		WARN_ON(!atomic_read(&kref->refcount));
> > +		atomic_inc(&kref->refcount);
> > +	}
> > +	return kref;
> > +}
> 
> Why is a NULL arg permitted here?

Because kobjects permitted it?  :)

I think you are correct, if we are passing a NULL pointer to these
functions, we deserve the oops we get, as other, much worse things could
happen (as a kref lives inside another structure.)

I'll go take those checks out.

thanks,

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

\
 
 \ /
  Last update: 2005-03-22 13:01    [from the cache]
©2003-2008