Re: [PATCH] ib: don't doublefree pages from scatterlist

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks, Hugh.  This is definitely a real bug caused by an embarassing
oversight on my part.  I will test and apply to my trees.

 > Warning: untested!  And please double-check the adjusted definition of
 > IB_UMEM_MAX_PAGE_CHUNK - the old definition was avoiding "sizeof"s, but
 > I don't understand why.

The old definition of IB_UMEM_MAX_PAGE_CHUNK came from my paranoia:

 >  #define IB_UMEM_MAX_PAGE_CHUNK						\
 >  	((PAGE_SIZE - offsetof(struct ib_umem_chunk, page_list)) /	\
 > -	 ((void *) &((struct ib_umem_chunk *) 0)->page_list[1] -	\
 > -	  (void *) &((struct ib_umem_chunk *) 0)->page_list[0]))
 > +	 (sizeof(struct scatterlist) + sizeof(struct page *)))

I was afraid that some compiler somewhere might add in some padding
that would cause sizeof (struct scatterlist) to be smaller than the
entries in the array end up being, but now I've convinced myself that
this can't happen -- if it could then things like ARRAY_SIZE() would
be stuffed as well.

So I think your version is correct and clearer.

Thanks,
  Roland
-
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]
  Powered by Linux