[PATCH] Fix ZERO_OR_NULL_PTR(ZERO_SIZE_PTR)

From: Roland Dreier
Date: Fri Jul 20 2007 - 15:13:36 EST


The comparison with ZERO_SIZE_PTR in ZERO_OR_NULL_PTR() needs to be <=
(not just <) so that ZERO_OR_NULL_PTR(ZERO_SIZE_PTR) is 1.

Signed-off-by: Roland Dreier <rolandd@xxxxxxxxx>
---
I finally had time to reproduce Michael's crash and debug it. Linus's
patch is part of the story -- it doesn't help unless ZERO_OR_NULL_PTR()
is true. With this change the crash goes away, and it seems pretty
obviously correct to me (unless I'm seriously confused).

include/linux/slab.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/slab.h b/include/linux/slab.h
index 7d0ecc1..d859354 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -40,7 +40,7 @@
*/
#define ZERO_SIZE_PTR ((void *)16)

-#define ZERO_OR_NULL_PTR(x) ((unsigned long)(x) < \
+#define ZERO_OR_NULL_PTR(x) ((unsigned long)(x) <= \
(unsigned long)ZERO_SIZE_PTR)

/*
-
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/