diff options
author | Andy Shevchenko <andy.shevchenko@gmail.com> | 2010-09-07 05:14:30 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-09-08 14:10:12 -0700 |
commit | a7a4f1c1a52912eb8b3bd4d8f628d83a8b5d69dd (patch) | |
tree | d683b304fb77097c09eb074140741abacacbfa16 /drivers/isdn/capi/capidrv.c | |
parent | fb8621bb6c040a25ac2fc246653859f841a1f53d (diff) | |
download | op-kernel-dev-a7a4f1c1a52912eb8b3bd4d8f628d83a8b5d69dd.zip op-kernel-dev-a7a4f1c1a52912eb8b3bd4d8f628d83a8b5d69dd.tar.gz |
drivers: isdn: capi: use simple_strtol to convert numbers
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Karsten Keil <isdn@linux-pingi.de>
Cc: Tilman Schmidt <tilman@imap.cc>
Cc: netdev@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn/capi/capidrv.c')
-rw-r--r-- | drivers/isdn/capi/capidrv.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/isdn/capi/capidrv.c b/drivers/isdn/capi/capidrv.c index 2978bda..e54e79d 100644 --- a/drivers/isdn/capi/capidrv.c +++ b/drivers/isdn/capi/capidrv.c @@ -1515,8 +1515,13 @@ static int decodeFVteln(char *teln, unsigned long *bmaskp, int *activep) while (*s) { int digit1 = 0; int digit2 = 0; - if (!isdigit(*s)) return -3; - while (isdigit(*s)) { digit1 = digit1*10 + (*s - '0'); s++; } + char *endp; + + digit1 = simple_strtoul(s, &endp, 10); + if (s == endp) + return -3; + s = endp; + if (digit1 <= 0 || digit1 > 30) return -4; if (*s == 0 || *s == ',' || *s == ' ') { bmask |= (1 << digit1); @@ -1526,8 +1531,12 @@ static int decodeFVteln(char *teln, unsigned long *bmaskp, int *activep) } if (*s != '-') return -5; s++; - if (!isdigit(*s)) return -3; - while (isdigit(*s)) { digit2 = digit2*10 + (*s - '0'); s++; } + + digit2 = simple_strtoul(s, &endp, 10); + if (s == endp) + return -3; + s = endp; + if (digit2 <= 0 || digit2 > 30) return -4; if (*s == 0 || *s == ',' || *s == ' ') { if (digit1 > digit2) |