Messages in this thread | | | Date | Fri, 13 Jul 2007 01:44:32 -0700 | From | Andrew Morton <> | Subject | Re: [PATCH] Add nid sanity on alloc_pages_node |
| |
On Fri, 13 Jul 2007 16:37:32 +0800 Joe Jin <joe.jin@oracle.com> 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 <joe.jin@oracle.com> > --- > > --- 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 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/
| |