Commit a7a4f1c1 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by David S. Miller

drivers: isdn: capi: use simple_strtol to convert numbers

Signed-off-by: default avatarAndy 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: default avatarDavid S. Miller <davem@davemloft.net>
parent fb8621bb
...@@ -1515,8 +1515,13 @@ static int decodeFVteln(char *teln, unsigned long *bmaskp, int *activep) ...@@ -1515,8 +1515,13 @@ static int decodeFVteln(char *teln, unsigned long *bmaskp, int *activep)
while (*s) { while (*s) {
int digit1 = 0; int digit1 = 0;
int digit2 = 0; int digit2 = 0;
if (!isdigit(*s)) return -3; char *endp;
while (isdigit(*s)) { digit1 = digit1*10 + (*s - '0'); s++; }
digit1 = simple_strtoul(s, &endp, 10);
if (s == endp)
return -3;
s = endp;
if (digit1 <= 0 || digit1 > 30) return -4; if (digit1 <= 0 || digit1 > 30) return -4;
if (*s == 0 || *s == ',' || *s == ' ') { if (*s == 0 || *s == ',' || *s == ' ') {
bmask |= (1 << digit1); bmask |= (1 << digit1);
...@@ -1526,8 +1531,12 @@ static int decodeFVteln(char *teln, unsigned long *bmaskp, int *activep) ...@@ -1526,8 +1531,12 @@ static int decodeFVteln(char *teln, unsigned long *bmaskp, int *activep)
} }
if (*s != '-') return -5; if (*s != '-') return -5;
s++; 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 (digit2 <= 0 || digit2 > 30) return -4;
if (*s == 0 || *s == ',' || *s == ' ') { if (*s == 0 || *s == ',' || *s == ' ') {
if (digit1 > digit2) if (digit1 > digit2)
......
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