a98d5ed4d292f29d80c9661e704ed6d0263236a5 Issues on lib/vsprintf.c file . lib/vsprintf.c | 74 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/lib/vsprintf.c b/lib/vsprintf.c index ccb664b..a1d03ba 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -246,10 +246,10 @@ char *put_dec_full8(char *buf, unsigned r) static noinline_for_stack char *put_dec(char *buf, unsigned long long n) { - if (n >= 100*1000*1000) + if (n >= (100*1000*1000)) buf = put_dec_full8(buf, do_div(n, 100*1000*1000)); /* 1 <= n <= 1.6e11 */ - if (n >= 100*1000*1000) + if (n >= (100*1000*1000)) buf = put_dec_full8(buf, do_div(n, 100*1000*1000)); /* 1 <= n < 1e8 */ return put_dec_trunc8(buf, n); @@ -296,7 +296,7 @@ char *put_dec(char *buf, unsigned long long n) { uint32_t d3, d2, d1, q, h; - if (n < 100*1000*1000) + if (n < (100*1000*1000)) return put_dec_trunc8(buf, n); d1 = ((uint32_t)n >> 16); /* implicit "& 0xffff" */ @@ -402,7 +402,7 @@ char *number(char *buf, char *end, unsigned long long num, char tmp[3 * sizeof(num)] __aligned(2); char sign; char locase; - int need_pfx = ((spec.flags & SPECIAL) && spec.base != 10); + int need_pfx = ((spec.flags & SPECIAL) && (spec.base != 10)); int i; bool is_zero = num == 0LL; int field_width = spec.field_width; @@ -474,7 +474,7 @@ char *number(char *buf, char *end, unsigned long long num, } /* "0x" / "0" prefix */ if (need_pfx) { - if (spec.base == 16 || !is_zero) { + if ((spec.base == 16) || !is_zero) { if (buf < end) *buf = '0'; ++buf; @@ -542,7 +542,7 @@ static void move_right(char *buf, char *end, unsigned len, unsigned spaces) return; } if (len) { - if (len > size - spaces) + if (len > (size - spaces)) len = size - spaces; memmove(buf + spaces, buf, len); } @@ -679,7 +679,7 @@ char *symbol_string(char *buf, char *end, void *ptr, #ifdef CONFIG_KALLSYMS if (*fmt == 'B') sprint_backtrace(sym, value); - else if (*fmt != 'f' && *fmt != 's') + else if ((*fmt != 'f') && (*fmt != 's')) sprint_symbol(sym, value); else sprint_symbol_no_offset(sym, value); @@ -769,7 +769,7 @@ char *resource_string(char *buf, char *end, struct resource *res, specp = &mem_spec; decode = 0; } - if (decode && res->flags & IORESOURCE_UNSET) { + if (decode && (res->flags & IORESOURCE_UNSET)) { p = string(p, pend, "size ", str_spec); p = number(p, pend, resource_size(res), *specp); } else { @@ -840,7 +840,7 @@ char *hex_string(char *buf, char *end, u8 *addr, struct printf_spec spec, *buf = hex_asc_lo(addr[i]); ++buf; - if (separator && i != len - 1) { + if (separator && (i != len - 1)) { if (buf < end) *buf = separator; ++buf; @@ -907,7 +907,7 @@ char *bitmap_list_string(char *buf, char *end, unsigned long *bitmap, while (cur < nr_bits) { rtop = cur; cur = find_next_bit(bitmap, nr_bits, cur + 1); - if (cur < nr_bits && cur <= rtop + 1) + if ((cur < nr_bits) && (cur <= rtop + 1)) continue; if (!first) { @@ -961,7 +961,7 @@ char *mac_address_string(char *buf, char *end, u8 *addr, else p = hex_byte_pack(p, addr[i]); - if (fmt[0] == 'M' && i != 5) + if ((fmt[0] == 'M') && (i != 5)) *p++ = separator; } *p = '\0'; @@ -1063,11 +1063,11 @@ char *ip6_compressed_string(char *p, const char *addr) /* emit address */ for (i = 0; i < range; i++) { if (i == colonpos) { - if (needcolon || i == 0) + if (needcolon || (i == 0)) *p++ = ':'; *p++ = ':'; needcolon = false; - i += longest - 1; + i += (longest - 1); continue; } if (needcolon) { @@ -1110,7 +1110,7 @@ char *ip6_string(char *p, const char *addr, const char *fmt) for (i = 0; i < 8; i++) { p = hex_byte_pack(p, *addr++); p = hex_byte_pack(p, *addr++); - if (fmt[0] == 'I' && i != 7) + if ((fmt[0] == 'I') && (i != 7)) *p++ = ':'; } *p = '\0'; @@ -1124,7 +1124,7 @@ char *ip6_addr_string(char *buf, char *end, const u8 *addr, { char ip6_addr[sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:255.255.255.255")]; - if (fmt[0] == 'I' && fmt[2] == 'c') + if ((fmt[0] == 'I') && (fmt[2] == 'c')) ip6_compressed_string(ip6_addr, addr); else ip6_string(ip6_addr, addr, fmt); @@ -1179,7 +1179,7 @@ char *ip6_addr_string_sa(char *buf, char *end, const struct sockaddr_in6 *sa, off = 1; } - if (fmt6[0] == 'I' && have_c) + if ((fmt6[0] == 'I') && have_c) p = ip6_compressed_string(ip6_addr + off, addr); else p = ip6_string(ip6_addr + off, addr, fmt6); @@ -1425,7 +1425,7 @@ char *format_flags(char *buf, char *end, unsigned long flags, .base = 16, }; - for ( ; flags && names->name; names++) { + for ( ; (flags) && names->name; names++) { mask = names->mask; if ((flags & mask) != mask) continue; @@ -1581,7 +1581,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, { const int default_width = 2 * sizeof(void *); - if (!ptr && *fmt != 'K') { + if (!ptr && (*fmt != 'K')) { /* * Print (null) with the same width as a pointer so it makes * tabular output look nice. @@ -1782,13 +1782,13 @@ int format_decode(const char *fmt, struct printf_spec *spec) /* By default */ spec->type = FORMAT_TYPE_NONE; - for (; *fmt ; ++fmt) { + for (; (*fmt) ; ++fmt) { if (*fmt == '%') break; } /* Return the current non-format string */ - if (fmt != start || !*fmt) + if ((fmt != start) || !*fmt) return fmt - start; /* Process flags */ @@ -1842,8 +1842,8 @@ precision: qualifier: /* get the conversion qualifier */ qualifier = 0; - if (*fmt == 'h' || _tolower(*fmt) == 'l' || - _tolower(*fmt) == 'z' || *fmt == 't') { + if ((*fmt == 'h') || (_tolower(*fmt) == 'l') || + (_tolower(*fmt) == 'z') || (*fmt == 't')) { qualifier = *fmt++; if (unlikely(qualifier == *fmt)) { if (qualifier == 'l') { @@ -2332,8 +2332,8 @@ do { \ const char *save_str = va_arg(args, char *); size_t len; - if ((unsigned long)save_str > (unsigned long)-PAGE_SIZE - || (unsigned long)save_str < PAGE_SIZE) + if (((unsigned long)save_str > (unsigned long)-PAGE_SIZE) + || ((unsigned long)save_str < PAGE_SIZE)) save_str = "(null)"; len = strlen(save_str) + 1; if (str + len < end) @@ -2450,7 +2450,7 @@ int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf) case FORMAT_TYPE_NONE: { int copy = read; if (str < end) { - if (copy > end - str) + if (copy > (end - str)) copy = end - str; memcpy(str, old_fmt, copy); } @@ -2624,7 +2624,7 @@ int vsscanf(const char *buf, const char *fmt, va_list args) } /* anything that is not a conversion must match exactly */ - if (*fmt != '%' && *fmt) { + if ((*fmt != '%') && *fmt) { if (*fmt++ != *str++) break; continue; @@ -2640,7 +2640,7 @@ int vsscanf(const char *buf, const char *fmt, va_list args) if (*fmt == '*') { if (!*str) break; - while (!isspace(*fmt) && *fmt != '%' && *fmt) { + while (!isspace(*fmt) && (*fmt != '%') && *fmt) { /* '%*[' not yet supported, invalid format */ if (*fmt == '[') return num; @@ -2661,8 +2661,8 @@ int vsscanf(const char *buf, const char *fmt, va_list args) /* get conversion qualifier */ qualifier = -1; - if (*fmt == 'h' || _tolower(*fmt) == 'l' || - _tolower(*fmt) == 'z') { + if ((*fmt == 'h') || (_tolower(*fmt) == 'l') || + (_tolower(*fmt) == 'z')) { qualifier = *fmt++; if (unlikely(qualifier == *fmt)) { if (qualifier == 'h') { @@ -2699,7 +2699,7 @@ int vsscanf(const char *buf, const char *fmt, va_list args) field_width = 1; do { *s++ = *str++; - } while (--field_width > 0 && *str); + } while ((--field_width > 0) && *str); num++; } continue; @@ -2747,7 +2747,7 @@ int vsscanf(const char *buf, const char *fmt, va_list args) if (negate) ++fmt; - for ( ; *fmt && *fmt != ']'; ++fmt, ++len) + for ( ; (*fmt) && *fmt != ']'; ++fmt, ++len) set_bit((u8)*fmt, set); /* no ']' or no character set found */ @@ -2800,14 +2800,14 @@ int vsscanf(const char *buf, const char *fmt, va_list args) str = skip_spaces(str); digit = *str; - if (is_sign && digit == '-') + if (is_sign && (digit == '-')) digit = *(str + 1); if (!digit - || (base == 16 && !isxdigit(digit)) - || (base == 10 && !isdigit(digit)) - || (base == 8 && (!isdigit(digit) || digit > '7')) - || (base == 0 && !isdigit(digit))) + || ((base == 16) && !isxdigit(digit)) + || ((base == 10) && !isdigit(digit)) + || ((base == 8) && (!isdigit(digit) || (digit > '7'))) + || ((base == 0) && !isdigit(digit))) break; if (is_sign) @@ -2819,7 +2819,7 @@ int vsscanf(const char *buf, const char *fmt, va_list args) simple_strtoul(str, &next, base) : simple_strtoull(str, &next, base); - if (field_width > 0 && next - str > field_width) { + if ((field_width > 0) && (next - str > field_width)) { if (base == 0) _parse_integer_fixup_radix(str, &base); while (next - str > field_width) { -- 2.7.4