diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/partitions/ldm.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/partitions/ldm.c b/fs/partitions/ldm.c index 3ceca05b668c..648c9d8f3357 100644 --- a/fs/partitions/ldm.c +++ b/fs/partitions/ldm.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/pagemap.h> | 27 | #include <linux/pagemap.h> |
28 | #include <linux/stringify.h> | 28 | #include <linux/stringify.h> |
29 | #include <linux/kernel.h> | ||
29 | #include "ldm.h" | 30 | #include "ldm.h" |
30 | #include "check.h" | 31 | #include "check.h" |
31 | #include "msdos.h" | 32 | #include "msdos.h" |
@@ -77,17 +78,16 @@ static int ldm_parse_hexbyte (const u8 *src) | |||
77 | int h; | 78 | int h; |
78 | 79 | ||
79 | /* high part */ | 80 | /* high part */ |
80 | if ((x = src[0] - '0') <= '9'-'0') h = x; | 81 | x = h = hex_to_bin(src[0]); |
81 | else if ((x = src[0] - 'a') <= 'f'-'a') h = x+10; | 82 | if (h < 0) |
82 | else if ((x = src[0] - 'A') <= 'F'-'A') h = x+10; | 83 | return -1; |
83 | else return -1; | ||
84 | h <<= 4; | ||
85 | 84 | ||
86 | /* low part */ | 85 | /* low part */ |
87 | if ((x = src[1] - '0') <= '9'-'0') return h | x; | 86 | h = hex_to_bin(src[1]); |
88 | if ((x = src[1] - 'a') <= 'f'-'a') return h | (x+10); | 87 | if (h < 0) |
89 | if ((x = src[1] - 'A') <= 'F'-'A') return h | (x+10); | 88 | return -1; |
90 | return -1; | 89 | |
90 | return (x << 4) + h; | ||
91 | } | 91 | } |
92 | 92 | ||
93 | /** | 93 | /** |