Commit af7ff2c2c45e6c6d533dd968709732da3d1d48f8
Committed by
James Morris
1 parent
59df3166ef
Exists in
master
and in
6 other branches
selinuxfs: remove custom hex_to_bin()
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Eric Paris <eparis@parisplace.org> Cc: James Morris <jmorris@namei.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: James Morris <jmorris@namei.org>
Showing 1 changed file with 4 additions and 10 deletions Side-by-side Diff
security/selinux/selinuxfs.c
... | ... | @@ -749,14 +749,6 @@ |
749 | 749 | return length; |
750 | 750 | } |
751 | 751 | |
752 | -static inline int hexcode_to_int(int code) { | |
753 | - if (code == '\0' || !isxdigit(code)) | |
754 | - return -1; | |
755 | - if (isdigit(code)) | |
756 | - return code - '0'; | |
757 | - return tolower(code) - 'a' + 10; | |
758 | -} | |
759 | - | |
760 | 752 | static ssize_t sel_write_create(struct file *file, char *buf, size_t size) |
761 | 753 | { |
762 | 754 | char *scon = NULL, *tcon = NULL; |
763 | 755 | |
... | ... | @@ -808,9 +800,11 @@ |
808 | 800 | if (c1 == '+') |
809 | 801 | c1 = ' '; |
810 | 802 | else if (c1 == '%') { |
811 | - if ((c1 = hexcode_to_int(*r++)) < 0) | |
803 | + c1 = hex_to_bin(*r++); | |
804 | + if (c1 < 0) | |
812 | 805 | goto out; |
813 | - if ((c2 = hexcode_to_int(*r++)) < 0) | |
806 | + c2 = hex_to_bin(*r++); | |
807 | + if (c2 < 0) | |
814 | 808 | goto out; |
815 | 809 | c1 = (c1 << 4) | c2; |
816 | 810 | } |