linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/slab.c remove impossible <0 check - size_t is not signed - patch is against 2.6.1-rc1-mm2
@ 2004-01-08  1:20 Jesper Juhl
  2004-01-08  3:08 ` Joe Perches
  0 siblings, 1 reply; 8+ messages in thread
From: Jesper Juhl @ 2004-01-08  1:20 UTC (permalink / raw)
  To: linux-kernel; +Cc: Mark Hemment, Andrea Arcangeli, Manfred Spraul


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.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-01-15  1:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-08  1:20 [PATCH] mm/slab.c remove impossible <0 check - size_t is not signed - patch is against 2.6.1-rc1-mm2 Jesper Juhl
2004-01-08  3:08 ` Joe Perches
2004-01-08  9:33   ` Jesper Juhl
2004-01-08 10:16     ` Paul Jackson
2004-01-08 15:28       ` Jens Axboe
2004-01-08 19:33         ` Manfred Spraul
2004-01-08 15:37       ` Joe Perches
2004-01-15  1:13         ` Bill Davidsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).