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>
This commit is contained in:
Borislav Petkov
2014-02-03 15:05:13 -05:00
parent 4675348e78
commit 9da21b1509
3 changed files with 9 additions and 7 deletions

View File

@@ -52,18 +52,20 @@ int edac_mc_get_poll_msec(void)
static int edac_set_poll_msec(const char *val, struct kernel_param *kp)
{
long l;
unsigned long l;
int ret;
if (!val)
return -EINVAL;
ret = kstrtol(val, 0, &l);
ret = kstrtoul(val, 0, &l);
if (ret)
return ret;
if (!l || ((int)l != l))
if (l < 1000)
return -EINVAL;
*((int *)kp->arg) = l;
*((unsigned long *)kp->arg) = l;
/* notify edac_mc engine to reset the poll period */
edac_mc_reset_delay_period(l);