summaryrefslogtreecommitdiffstats
path: root/net/core/pktgen.c
diff options
context:
space:
mode:
authorAndy Shevchenko <andy.shevchenko@gmail.com>2010-09-20 20:40:26 +0000
committerDavid S. Miller <davem@davemloft.net>2010-09-21 18:04:45 -0700
commit82fd5b5d1ec370a50b3060418cde6a4ac8401117 (patch)
treed9a30b87d31636d4ad8fa0df96c9fb031564010e /net/core/pktgen.c
parent66bb16de6b9a05936d1eeb20155bab008b476191 (diff)
downloadblackbird-op-linux-82fd5b5d1ec370a50b3060418cde6a4ac8401117.tar.gz
blackbird-op-linux-82fd5b5d1ec370a50b3060418cde6a4ac8401117.zip
net: core: use kernel's converter from hex to bin
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/pktgen.c')
-rw-r--r--net/core/pktgen.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 386c2283f14e..2c0df0f95b3d 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -729,16 +729,14 @@ static int hex32_arg(const char __user *user_buffer, unsigned long maxlen,
*num = 0;
for (; i < maxlen; i++) {
+ int value;
char c;
*num <<= 4;
if (get_user(c, &user_buffer[i]))
return -EFAULT;
- if ((c >= '0') && (c <= '9'))
- *num |= c - '0';
- else if ((c >= 'a') && (c <= 'f'))
- *num |= c - 'a' + 10;
- else if ((c >= 'A') && (c <= 'F'))
- *num |= c - 'A' + 10;
+ value = hex_to_bin(c);
+ if (value >= 0)
+ *num |= value;
else
break;
}
OpenPOWER on IntegriCloud