From: "Ahmed S. Darwish" Use ARRAY_SIZE macro already defined in kernel.h Signed-off-by: Ahmed S. Darwish Cc: Neil Brown Signed-off-by: Andrew Morton --- drivers/md/md.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff -puN drivers/md/md.c~drivers-mdc-use-array_size-macro-when-appropriate drivers/md/md.c --- a/drivers/md/md.c~drivers-mdc-use-array_size-macro-when-appropriate +++ a/drivers/md/md.c @@ -33,6 +33,7 @@ */ #include +#include #include #include #include @@ -2637,8 +2638,7 @@ metadata_store(mddev_t *mddev, const cha minor = simple_strtoul(buf, &e, 10); if (e==buf || (*e && *e != '\n') ) return -EINVAL; - if (major >= sizeof(super_types)/sizeof(super_types[0]) || - super_types[major].name == NULL) + if (major >= ARRAY_SIZE(super_types) || super_types[major].name == NULL) return -ENOENT; mddev->major_version = major; mddev->minor_version = minor; @@ -4019,7 +4019,7 @@ static int set_array_info(mddev_t * mdde if (info->raid_disks == 0) { /* just setting version number for superblock loading */ if (info->major_version < 0 || - info->major_version >= sizeof(super_types)/sizeof(super_types[0]) || + info->major_version >= ARRAY_SIZE(super_types) || super_types[info->major_version].name == NULL) { /* maybe try to auto-load a module? */ printk(KERN_INFO _