Roel Kluin
2009-Jul-23 16:23 UTC
[Ocfs2-devel] [PATCH] ocfs2: Keep index within status_map[]
Do not exceed array status_map[]
Signed-off-by: Roel Kluin <roel.kluin at 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];
}
Seemingly Similar Threads
- [GIT PULL] ocfs2 fixes for 2.6.31-rc5
- [PATCH] ocfs2: Provide the ocfs2_dlm_lvb_valid() stack API.
- [PATCH] ocfs2: Fix contiguousness check in ocfs2_try_to_merge_extent_map()
- [PATCH] xen/blkfront: remove driver_data direct access of struct device
- [PATCH] xen/blkfront: remove driver_data direct access of struct device
