[patch 22/54] ntfs_init_locked_inode(): fix array indexing

From: Chris Wright
Date: Fri Jun 08 2007 - 03:59:17 EST

-stable review patch. If anyone has any objections, please let us know.

From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>

Local variable `i' is a byte-counter. Don't use it as an index into an array
of le32's.

Reported-by: "young dave" <hidave.darkstar@xxxxxxxxx>
Cc: "Christoph Lameter" <clameter@xxxxxxx>
Acked-by: Anton Altaparmakov <aia21@xxxxxxxxxx>
Cc: <stable@xxxxxxxxxx>
Cc: Adrian Bunk <bunk@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Chris Wright <chrisw@xxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>
fs/ntfs/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-
+++ linux-
@@ -141,7 +141,7 @@ static int ntfs_init_locked_inode(struct
if (!ni->name)
return -ENOMEM;
memcpy(ni->name, na->name, i);
- ni->name[i] = 0;
+ ni->name[na->name_len] = 0;
return 0;

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/