Commit 50511da3 authored by Ahmed S. Darwish's avatar Ahmed S. Darwish Committed by Linus Torvalds

drivers/md.c: Use ARRAY_SIZE macro when appropriate

Use ARRAY_SIZE macro already defined in kernel.h
Signed-off-by: default avatarAhmed S. Darwish <darwish.07@gmail.com>
Acked-by: default avatarNeil Brown <neilb@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent bc0ca06e
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h>
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/linkage.h> #include <linux/linkage.h>
#include <linux/raid/md.h> #include <linux/raid/md.h>
...@@ -2637,8 +2638,7 @@ metadata_store(mddev_t *mddev, const char *buf, size_t len) ...@@ -2637,8 +2638,7 @@ metadata_store(mddev_t *mddev, const char *buf, size_t len)
minor = simple_strtoul(buf, &e, 10); minor = simple_strtoul(buf, &e, 10);
if (e==buf || (*e && *e != '\n') ) if (e==buf || (*e && *e != '\n') )
return -EINVAL; return -EINVAL;
if (major >= sizeof(super_types)/sizeof(super_types[0]) || if (major >= ARRAY_SIZE(super_types) || super_types[major].name == NULL)
super_types[major].name == NULL)
return -ENOENT; return -ENOENT;
mddev->major_version = major; mddev->major_version = major;
mddev->minor_version = minor; mddev->minor_version = minor;
...@@ -4019,7 +4019,7 @@ static int set_array_info(mddev_t * mddev, mdu_array_info_t *info) ...@@ -4019,7 +4019,7 @@ static int set_array_info(mddev_t * mddev, mdu_array_info_t *info)
if (info->raid_disks == 0) { if (info->raid_disks == 0) {
/* just setting version number for superblock loading */ /* just setting version number for superblock loading */
if (info->major_version < 0 || 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) { super_types[info->major_version].name == NULL) {
/* maybe try to auto-load a module? */ /* maybe try to auto-load a module? */
printk(KERN_INFO printk(KERN_INFO
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment