aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 39c9c87a1342..aaa3d465de4e 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2394,12 +2394,11 @@ safe_delay_store(mddev_t *mddev, const char *cbuf, size_t len)
2394 int i; 2394 int i;
2395 unsigned long msec; 2395 unsigned long msec;
2396 char buf[30]; 2396 char buf[30];
2397 char *e; 2397
2398 /* remove a period, and count digits after it */ 2398 /* remove a period, and count digits after it */
2399 if (len >= sizeof(buf)) 2399 if (len >= sizeof(buf))
2400 return -EINVAL; 2400 return -EINVAL;
2401 strlcpy(buf, cbuf, len); 2401 strlcpy(buf, cbuf, sizeof(buf));
2402 buf[len] = 0;
2403 for (i=0; i<len; i++) { 2402 for (i=0; i<len; i++) {
2404 if (dot) { 2403 if (dot) {
2405 if (isdigit(buf[i])) { 2404 if (isdigit(buf[i])) {
@@ -2412,8 +2411,7 @@ safe_delay_store(mddev_t *mddev, const char *cbuf, size_t len)
2412 buf[i] = 0; 2411 buf[i] = 0;
2413 } 2412 }
2414 } 2413 }
2415 msec = simple_strtoul(buf, &e, 10); 2414 if (strict_strtoul(buf, 10, &msec) < 0)
2416 if (e == buf || (*e && *e != '\n'))
2417 return -EINVAL; 2415 return -EINVAL;
2418 msec = (msec * 1000) / scale; 2416 msec = (msec * 1000) / scale;
2419 if (msec == 0) 2417 if (msec == 0)