[PATCH] mm/slab.c remove impossible <0 check - size_t is not signed- patch is against 2.6.1-rc1-mm2

From: Jesper Juhl
Date: Wed Jan 07 2004 - 20:24:11 EST



In mm/slab.c in the function kmem_cache_create, there's a check for
'offset < 0' that is completely unnessesary since 'offset' is of
type size_t, and size_t is an unsigned datatype in all archs.

The patch below removes this un-needed code - even gcc agrees that this
code is not needed and that case can never happen.


--- linux-2.6.1-rc1-mm2-orig/mm/slab.c 2004-01-06 01:33:09.000000000 +0100
+++ linux-2.6.1-rc1-mm2/mm/slab.c 2004-01-08 02:08:33.000000000 +0100
@@ -1042,7 +1042,7 @@ kmem_cache_create (const char *name, siz
(size < BYTES_PER_WORD) ||
(size > (1<<MAX_OBJ_ORDER)*PAGE_SIZE) ||
(dtor && !ctor) ||
- (offset < 0 || offset > size))
+ (offset > size))
BUG();

#if DEBUG


Patch is compile tested, that's all - but it seems to be 'obviously
correct' to me.


Kind regards,

Jesper Juhl



PS. CC'ing the people mentioned in the comments of mm/slab.c since I
couldn't fine any single person responsible for this file in MAINTAINERS -
hope that's OK.

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