All of lore.kernel.org
 help / color / mirror / Atom feed
* [Ocfs2-devel] [PATCH] ocfs2: Keep index within status_map[]
@ 2009-07-23 16:23 Roel Kluin
  0 siblings, 0 replies; only message in thread
From: Roel Kluin @ 2009-07-23 16:23 UTC (permalink / raw)
  To: ocfs2-devel

Do not exceed array status_map[]

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/fs/ocfs2/stack_o2cb.c b/fs/ocfs2/stack_o2cb.c
index 3f66137..e49c410 100644
--- a/fs/ocfs2/stack_o2cb.c
+++ b/fs/ocfs2/stack_o2cb.c
@@ -17,6 +17,7 @@
  * General Public License for more details.
  */
 
+#include <linux/kernel.h>
 #include <linux/crc32.h>
 #include <linux/module.h>
 
@@ -153,7 +154,7 @@ static int status_map[] = {
 
 static int dlm_status_to_errno(enum dlm_status status)
 {
-	BUG_ON(status > (sizeof(status_map) / sizeof(status_map[0])));
+	BUG_ON(status < 0 || status >= ARRAY_SIZE(status_map));
 
 	return status_map[status];
 }

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-07-23 16:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-23 16:23 [Ocfs2-devel] [PATCH] ocfs2: Keep index within status_map[] Roel Kluin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.