Skip to content

Commit 69e4469

Browse files
Andy Shevchenkotorvalds
authored andcommitted
sysctl: don't use own implementation of hex_to_bin()
Remove own implementation of hex_to_bin(). Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com> Cc: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 96b89f3 commit 69e4469

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

kernel/sysctl_binary.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/file.h>
1414
#include <linux/ctype.h>
1515
#include <linux/netdevice.h>
16+
#include <linux/kernel.h>
1617
#include <linux/slab.h>
1718

1819
#ifdef CONFIG_SYSCTL_SYSCALL
@@ -1124,11 +1125,6 @@ static ssize_t bin_ulongvec(struct file *file,
11241125
return result;
11251126
}
11261127

1127-
static unsigned hex_value(int ch)
1128-
{
1129-
return isdigit(ch) ? ch - '0' : ((ch | 0x20) - 'a') + 10;
1130-
}
1131-
11321128
static ssize_t bin_uuid(struct file *file,
11331129
void __user *oldval, size_t oldlen, void __user *newval, size_t newlen)
11341130
{
@@ -1156,7 +1152,8 @@ static ssize_t bin_uuid(struct file *file,
11561152
if (!isxdigit(str[0]) || !isxdigit(str[1]))
11571153
goto out;
11581154

1159-
uuid[i] = (hex_value(str[0]) << 4) | hex_value(str[1]);
1155+
uuid[i] = (hex_to_bin(str[0]) << 4) |
1156+
hex_to_bin(str[1]);
11601157
str += 2;
11611158
if (*str == '-')
11621159
str++;

0 commit comments

Comments
 (0)