ocfs2: add handler_map array bounds checking
authorTiger Yang <tiger.yang@oracle.com>
Thu, 23 Oct 2008 08:34:44 +0000 (16:34 +0800)
committerMark Fasheh <mfasheh@suse.com>
Mon, 10 Nov 2008 17:51:44 +0000 (09:51 -0800)
Make the handler_map array as large as the possible value range to avoid
a fencepost error.

[ Utilize alternate method -- Joel ]

Signed-off-by: Tiger Yang <tiger.yang@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
fs/ocfs2/xattr.c

index a9da45b..e19980a 100644 (file)
@@ -78,7 +78,7 @@ struct xattr_handler *ocfs2_xattr_handlers[] = {
        NULL
 };
 
-static struct xattr_handler *ocfs2_xattr_handler_map[] = {
+static struct xattr_handler *ocfs2_xattr_handler_map[OCFS2_XATTR_MAX] = {
        [OCFS2_XATTR_INDEX_USER]        = &ocfs2_xattr_user_handler,
        [OCFS2_XATTR_INDEX_TRUSTED]     = &ocfs2_xattr_trusted_handler,
 };