diff options
Diffstat (limited to 'drivers/media/video/pvrusb2/pvrusb2-debugifc.c')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-debugifc.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-debugifc.c b/drivers/media/video/pvrusb2/pvrusb2-debugifc.c index e9b11e119f62..4279ebb811a1 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-debugifc.c +++ b/drivers/media/video/pvrusb2/pvrusb2-debugifc.c | |||
@@ -94,8 +94,6 @@ static int debugifc_parse_unsigned_number(const char *buf,unsigned int count, | |||
94 | u32 *num_ptr) | 94 | u32 *num_ptr) |
95 | { | 95 | { |
96 | u32 result = 0; | 96 | u32 result = 0; |
97 | u32 val; | ||
98 | int ch; | ||
99 | int radix = 10; | 97 | int radix = 10; |
100 | if ((count >= 2) && (buf[0] == '0') && | 98 | if ((count >= 2) && (buf[0] == '0') && |
101 | ((buf[1] == 'x') || (buf[1] == 'X'))) { | 99 | ((buf[1] == 'x') || (buf[1] == 'X'))) { |
@@ -107,17 +105,9 @@ static int debugifc_parse_unsigned_number(const char *buf,unsigned int count, | |||
107 | } | 105 | } |
108 | 106 | ||
109 | while (count--) { | 107 | while (count--) { |
110 | ch = *buf++; | 108 | int val = hex_to_bin(*buf++); |
111 | if ((ch >= '0') && (ch <= '9')) { | 109 | if (val < 0 || val >= radix) |
112 | val = ch - '0'; | ||
113 | } else if ((ch >= 'a') && (ch <= 'f')) { | ||
114 | val = ch - 'a' + 10; | ||
115 | } else if ((ch >= 'A') && (ch <= 'F')) { | ||
116 | val = ch - 'A' + 10; | ||
117 | } else { | ||
118 | return -EINVAL; | 110 | return -EINVAL; |
119 | } | ||
120 | if (val >= radix) return -EINVAL; | ||
121 | result *= radix; | 111 | result *= radix; |
122 | result += val; | 112 | result += val; |
123 | } | 113 | } |