lkml.org 
[lkml]   [2010]   [Mar]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch] afs: potential null dereference
On Mon, Mar 22, 2010 at 12:05:20PM +0000, David Howells wrote:
> Dan Carpenter <error27@gmail.com> wrote:
> > It seems clear from the surrounding code that xpermits is allowed to be
> > NULL here.
>
> Interesting. The memcpy() won't oops due to this because if it is given a
> NULL pointer, it will also be given a zero count. I wonder if this means the
> if-statement your patch adds is actually unnecessary...
>

I was concerned about the dereference here:

+ if (xpermits)
+ memcpy(permits->permits, xpermits->permits,
^^^^^^^^^^^^^^^^^
+ count * sizeof(struct afs_permit));
This code has been there for three years, so yeah, you would think if it
were a problem someone would have complained. My theory was "xpermits"
was almost always non-null.

regards,
dan carpenter

> David


\
 
 \ /
  Last update: 2010-03-22 13:59    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site