From f2f7fdfffcc792ec85a4631510c2eae545dfa448 Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Fri, 30 Sep 2011 14:45:40 +0300 Subject: [PATCH] --- yaml --- r: 264679 b: refs/heads/master c: 635a2b3f3e561278cb5b837ea305e50e3fa7f063 h: refs/heads/master i: 264677: e224e180a73e5c62faa22890f74785a6a2c633a2 264675: 0886a84c5d930458e363e3ef3a652fd1d5ff502e 264671: 8f76ba57a8ddd07c887607689f0eb0007b5a2928 v: v3 --- [refs] | 2 +- trunk/drivers/target/tcm_fc/tfc_conf.c | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/[refs] b/[refs] index 2ea59c2b6da7..ff805d75eeec 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: f2b56afd406b455fba339a35f43bfc4ada198073 +refs/heads/master: 635a2b3f3e561278cb5b837ea305e50e3fa7f063 diff --git a/trunk/drivers/target/tcm_fc/tfc_conf.c b/trunk/drivers/target/tcm_fc/tfc_conf.c index b30eace70d35..5f770412ca40 100644 --- a/trunk/drivers/target/tcm_fc/tfc_conf.c +++ b/trunk/drivers/target/tcm_fc/tfc_conf.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -70,10 +71,10 @@ static ssize_t ft_parse_wwn(const char *name, u64 *wwn, int strict) { const char *cp; char c; - u32 nibble; u32 byte = 0; u32 pos = 0; u32 err; + int val; *wwn = 0; for (cp = name; cp < &name[FT_NAMELEN - 1]; cp++) { @@ -94,13 +95,10 @@ static ssize_t ft_parse_wwn(const char *name, u64 *wwn, int strict) return cp - name; } err = 3; - if (isdigit(c)) - nibble = c - '0'; - else if (isxdigit(c) && (islower(c) || !strict)) - nibble = tolower(c) - 'a' + 10; - else + val = hex_to_bin(c); + if (val < 0 || (strict && isupper(c))) goto fail; - *wwn = (*wwn << 4) | nibble; + *wwn = (*wwn << 4) | val; } err = 4; fail: