X-Git-Url: http://git.monstr.eu/?a=blobdiff_plain;f=lib%2Fseq_buf.c;h=6dafde851333759ebb3afde4d75967f35d539178;hb=4ea90317956718e0648e1f87e56530db809a5a04;hp=707453f5d58ee056010684f19b80756cbeb00c9e;hpb=0f43283be7fec4a76cd4ed50dc37db30719bde05;p=linux-2.6-microblaze.git diff --git a/lib/seq_buf.c b/lib/seq_buf.c index 707453f5d58e..6dafde851333 100644 --- a/lib/seq_buf.c +++ b/lib/seq_buf.c @@ -229,8 +229,10 @@ int seq_buf_putmem_hex(struct seq_buf *s, const void *mem, WARN_ON(s->size == 0); + BUILD_BUG_ON(MAX_MEMHEX_BYTES * 2 >= HEX_CHARS); + while (len) { - start_len = min(len, HEX_CHARS - 1); + start_len = min(len, MAX_MEMHEX_BYTES); #ifdef __BIG_ENDIAN for (i = 0, j = 0; i < start_len; i++) { #else @@ -243,12 +245,14 @@ int seq_buf_putmem_hex(struct seq_buf *s, const void *mem, break; /* j increments twice per loop */ - len -= j / 2; hex[j++] = ' '; seq_buf_putmem(s, hex, j); if (seq_buf_has_overflowed(s)) return -1; + + len -= start_len; + data += start_len; } return 0; }