diff options
author | Borislav Petkov <bp@suse.de> | 2014-02-03 15:05:13 -0500 |
---|---|---|
committer | Borislav Petkov <bp@suse.de> | 2014-02-14 04:40:29 -0500 |
commit | 9da21b1509d8aa7ab4846722817d16c72d656c91 (patch) | |
tree | e21027dab66b50e1f21e3dd9b62846f7473bda8a /drivers/edac/edac_mc_sysfs.c | |
parent | 4675348e78fab420e70f9144b320d9c063c7cee8 (diff) |
EDAC: Poll timeout cannot be zero, p2
Sanitize code even more to accept unsigned longs only and to not allow
polling intervals below 1 second as this is unnecessary and doesn't make
much sense anyway for polling errors.
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: http://lkml.kernel.org/r/1391457913-881-1-git-send-email-prarit@redhat.com
Cc: Doug Thompson <dougthompson@xmission.com>
Cc: <stable@vger.kernel.org>
Diffstat (limited to 'drivers/edac/edac_mc_sysfs.c')
-rw-r--r-- | drivers/edac/edac_mc_sysfs.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c index 8ec1747b1c39..b335c6ab5efe 100644 --- a/drivers/edac/edac_mc_sysfs.c +++ b/drivers/edac/edac_mc_sysfs.c | |||
@@ -52,18 +52,20 @@ int edac_mc_get_poll_msec(void) | |||
52 | 52 | ||
53 | static int edac_set_poll_msec(const char *val, struct kernel_param *kp) | 53 | static int edac_set_poll_msec(const char *val, struct kernel_param *kp) |
54 | { | 54 | { |
55 | long l; | 55 | unsigned long l; |
56 | int ret; | 56 | int ret; |
57 | 57 | ||
58 | if (!val) | 58 | if (!val) |
59 | return -EINVAL; | 59 | return -EINVAL; |
60 | 60 | ||
61 | ret = kstrtol(val, 0, &l); | 61 | ret = kstrtoul(val, 0, &l); |
62 | if (ret) | 62 | if (ret) |
63 | return ret; | 63 | return ret; |
64 | if (!l || ((int)l != l)) | 64 | |
65 | if (l < 1000) | ||
65 | return -EINVAL; | 66 | return -EINVAL; |
66 | *((int *)kp->arg) = l; | 67 | |
68 | *((unsigned long *)kp->arg) = l; | ||
67 | 69 | ||
68 | /* notify edac_mc engine to reset the poll period */ | 70 | /* notify edac_mc engine to reset the poll period */ |
69 | edac_mc_reset_delay_period(l); | 71 | edac_mc_reset_delay_period(l); |