diff options
author | Paul Mundt <lethal@linux-sh.org> | 2010-05-31 13:14:26 +0900 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-05-31 13:14:26 +0900 |
commit | d5b732b17ca2fc74f370bdba5aae6c804fac8c35 (patch) | |
tree | 4facc6d96116b032a3c1cb2ced9b2a3008e9216e /fs/partitions/ldm.c | |
parent | eb6e8605ee5f5b4e116451bf01b3f35eac446dde (diff) | |
parent | 67a3e12b05e055c0415c556a315a3d3eb637e29e (diff) | |
download | talos-op-linux-d5b732b17ca2fc74f370bdba5aae6c804fac8c35.tar.gz talos-op-linux-d5b732b17ca2fc74f370bdba5aae6c804fac8c35.zip |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'fs/partitions/ldm.c')
-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 @@ #include <linux/slab.h> #include <linux/pagemap.h> #include <linux/stringify.h> +#include <linux/kernel.h> #include "ldm.h" #include "check.h" #include "msdos.h" @@ -77,17 +78,16 @@ static int ldm_parse_hexbyte (const u8 *src) int h; /* high part */ - if ((x = src[0] - '0') <= '9'-'0') h = x; - else if ((x = src[0] - 'a') <= 'f'-'a') h = x+10; - else if ((x = src[0] - 'A') <= 'F'-'A') h = x+10; - else return -1; - h <<= 4; + x = h = hex_to_bin(src[0]); + if (h < 0) + return -1; /* low part */ - if ((x = src[1] - '0') <= '9'-'0') return h | x; - if ((x = src[1] - 'a') <= 'f'-'a') return h | (x+10); - if ((x = src[1] - 'A') <= 'F'-'A') return h | (x+10); - return -1; + h = hex_to_bin(src[1]); + if (h < 0) + return -1; + + return (x << 4) + h; } /** |