pktgen.c (ba4fd9d8282f7f856f2287fe8be784d1dfdda28b) | pktgen.c (82fd5b5d1ec370a50b3060418cde6a4ac8401117) |
---|---|
1/* 2 * Authors: 3 * Copyright 2001, 2002 by Robert Olsson <robert.olsson@its.uu.se> 4 * Uppsala University and 5 * Swedish University of Agricultural Sciences 6 * 7 * Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> 8 * Ben Greear <greearb@candelatech.com> --- 715 unchanged lines hidden (view full) --- 724 725static int hex32_arg(const char __user *user_buffer, unsigned long maxlen, 726 __u32 *num) 727{ 728 int i = 0; 729 *num = 0; 730 731 for (; i < maxlen; i++) { | 1/* 2 * Authors: 3 * Copyright 2001, 2002 by Robert Olsson <robert.olsson@its.uu.se> 4 * Uppsala University and 5 * Swedish University of Agricultural Sciences 6 * 7 * Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> 8 * Ben Greear <greearb@candelatech.com> --- 715 unchanged lines hidden (view full) --- 724 725static int hex32_arg(const char __user *user_buffer, unsigned long maxlen, 726 __u32 *num) 727{ 728 int i = 0; 729 *num = 0; 730 731 for (; i < maxlen; i++) { |
732 int value; |
|
732 char c; 733 *num <<= 4; 734 if (get_user(c, &user_buffer[i])) 735 return -EFAULT; | 733 char c; 734 *num <<= 4; 735 if (get_user(c, &user_buffer[i])) 736 return -EFAULT; |
736 if ((c >= '0') && (c <= '9')) 737 *num |= c - '0'; 738 else if ((c >= 'a') && (c <= 'f')) 739 *num |= c - 'a' + 10; 740 else if ((c >= 'A') && (c <= 'F')) 741 *num |= c - 'A' + 10; | 737 value = hex_to_bin(c); 738 if (value >= 0) 739 *num |= value; |
742 else 743 break; 744 } 745 return i; 746} 747 748static int count_trail_chars(const char __user * user_buffer, 749 unsigned int maxlen) --- 3192 unchanged lines hidden --- | 740 else 741 break; 742 } 743 return i; 744} 745 746static int count_trail_chars(const char __user * user_buffer, 747 unsigned int maxlen) --- 3192 unchanged lines hidden --- |