Re: [PATCH] Add nid sanity on alloc_pages_node

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

 



On Fri, 13 Jul 2007 16:37:32 +0800 Joe Jin <[email protected]> wrote:

> > 
> > if (nid > MAX_NUMNODES) then that is a bug and we should report it (doing
> > this via a BUG() is OK) rather than quietly covering it up.
> 
> I have create a patch to check if nid > MAX_NUMNODES, please apply it
> thanks
> 
> Signed-off-by: Joe Jin <[email protected]>
> ---
> 
> --- linux-2.6.22/include/linux/gfp.h.orig	2007-07-12 15:06:23.000000000 +0800
> +++ linux-2.6.22/include/linux/gfp.h	2007-07-13 16:23:52.000000000 +0800
> @@ -127,6 +127,8 @@ FASTCALL(__alloc_pages(gfp_t, unsigned i
>  static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
>  						unsigned int order)
>  {
> +	BUG_ON(nid > MAX_NUMNODES);
> +
>  	if (unlikely(order >= MAX_ORDER))
>  		return NULL;
>  

nope ;)

Would really prefer not to go adding overhead like this into a
frequently-called and frequently-inlined codepath.

If we do have a bug in a caller then the code will go on to overindex
NODE_DATA() which will hopefully produce a nice oops for at least some
people, and that's good enough.

-
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