aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Kconfig.debug8
-rw-r--r--lib/decompress_inflate.c8
-rw-r--r--lib/decompress_unlzma.c10
-rw-r--r--lib/vsprintf.c27
4 files changed, 41 insertions, 12 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index d57b12f59c8c..891155817bc6 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -50,6 +50,14 @@ config MAGIC_SYSRQ
50 keys are documented in <file:Documentation/sysrq.txt>. Don't say Y 50 keys are documented in <file:Documentation/sysrq.txt>. Don't say Y
51 unless you really know what this hack does. 51 unless you really know what this hack does.
52 52
53config STRIP_ASM_SYMS
54 bool "Strip assembler-generated symbols during link"
55 default n
56 help
57 Strip internal assembler-generated symbols during a link (symbols
58 that look like '.Lxxx') so they don't pollute the output of
59 get_wchan() and suchlike.
60
53config UNUSED_SYMBOLS 61config UNUSED_SYMBOLS
54 bool "Enable unused/obsolete exported symbols" 62 bool "Enable unused/obsolete exported symbols"
55 default y if X86 63 default y if X86
diff --git a/lib/decompress_inflate.c b/lib/decompress_inflate.c
index 68dfce59c1b8..fc686c7a0a0d 100644
--- a/lib/decompress_inflate.c
+++ b/lib/decompress_inflate.c
@@ -27,6 +27,11 @@
27 27
28#define GZIP_IOBUF_SIZE (16*1024) 28#define GZIP_IOBUF_SIZE (16*1024)
29 29
30static int nofill(void *buffer, unsigned int len)
31{
32 return -1;
33}
34
30/* Included from initramfs et al code */ 35/* Included from initramfs et al code */
31STATIC int INIT gunzip(unsigned char *buf, int len, 36STATIC int INIT gunzip(unsigned char *buf, int len,
32 int(*fill)(void*, unsigned int), 37 int(*fill)(void*, unsigned int),
@@ -76,6 +81,9 @@ STATIC int INIT gunzip(unsigned char *buf, int len,
76 goto gunzip_nomem4; 81 goto gunzip_nomem4;
77 } 82 }
78 83
84 if (!fill)
85 fill = nofill;
86
79 if (len == 0) 87 if (len == 0)
80 len = fill(zbuf, GZIP_IOBUF_SIZE); 88 len = fill(zbuf, GZIP_IOBUF_SIZE);
81 89
diff --git a/lib/decompress_unlzma.c b/lib/decompress_unlzma.c
index 0b954e04bd30..ca82fde81c8f 100644
--- a/lib/decompress_unlzma.c
+++ b/lib/decompress_unlzma.c
@@ -82,6 +82,11 @@ struct rc {
82#define RC_MODEL_TOTAL_BITS 11 82#define RC_MODEL_TOTAL_BITS 11
83 83
84 84
85static int nofill(void *buffer, unsigned int len)
86{
87 return -1;
88}
89
85/* Called twice: once at startup and once in rc_normalize() */ 90/* Called twice: once at startup and once in rc_normalize() */
86static void INIT rc_read(struct rc *rc) 91static void INIT rc_read(struct rc *rc)
87{ 92{
@@ -97,7 +102,10 @@ static inline void INIT rc_init(struct rc *rc,
97 int (*fill)(void*, unsigned int), 102 int (*fill)(void*, unsigned int),
98 char *buffer, int buffer_size) 103 char *buffer, int buffer_size)
99{ 104{
100 rc->fill = fill; 105 if (fill)
106 rc->fill = fill;
107 else
108 rc->fill = nofill;
101 rc->buffer = (uint8_t *)buffer; 109 rc->buffer = (uint8_t *)buffer;
102 rc->buffer_size = buffer_size; 110 rc->buffer_size = buffer_size;
103 rc->buffer_end = rc->buffer + rc->buffer_size; 111 rc->buffer_end = rc->buffer + rc->buffer_size;
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 73a14b8c6d1f..33bed5e67a21 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -671,7 +671,7 @@ static char *ip4_string(char *p, const u8 *addr, bool leading_zeros)
671 return p; 671 return p;
672} 672}
673 673
674static char *ip6_compressed_string(char *p, const struct in6_addr *addr) 674static char *ip6_compressed_string(char *p, const char *addr)
675{ 675{
676 int i; 676 int i;
677 int j; 677 int j;
@@ -683,7 +683,12 @@ static char *ip6_compressed_string(char *p, const struct in6_addr *addr)
683 u8 hi; 683 u8 hi;
684 u8 lo; 684 u8 lo;
685 bool needcolon = false; 685 bool needcolon = false;
686 bool useIPv4 = ipv6_addr_v4mapped(addr) || ipv6_addr_is_isatap(addr); 686 bool useIPv4;
687 struct in6_addr in6;
688
689 memcpy(&in6, addr, sizeof(struct in6_addr));
690
691 useIPv4 = ipv6_addr_v4mapped(&in6) || ipv6_addr_is_isatap(&in6);
687 692
688 memset(zerolength, 0, sizeof(zerolength)); 693 memset(zerolength, 0, sizeof(zerolength));
689 694
@@ -695,7 +700,7 @@ static char *ip6_compressed_string(char *p, const struct in6_addr *addr)
695 /* find position of longest 0 run */ 700 /* find position of longest 0 run */
696 for (i = 0; i < range; i++) { 701 for (i = 0; i < range; i++) {
697 for (j = i; j < range; j++) { 702 for (j = i; j < range; j++) {
698 if (addr->s6_addr16[j] != 0) 703 if (in6.s6_addr16[j] != 0)
699 break; 704 break;
700 zerolength[i]++; 705 zerolength[i]++;
701 } 706 }
@@ -722,7 +727,7 @@ static char *ip6_compressed_string(char *p, const struct in6_addr *addr)
722 needcolon = false; 727 needcolon = false;
723 } 728 }
724 /* hex u16 without leading 0s */ 729 /* hex u16 without leading 0s */
725 word = ntohs(addr->s6_addr16[i]); 730 word = ntohs(in6.s6_addr16[i]);
726 hi = word >> 8; 731 hi = word >> 8;
727 lo = word & 0xff; 732 lo = word & 0xff;
728 if (hi) { 733 if (hi) {
@@ -741,19 +746,19 @@ static char *ip6_compressed_string(char *p, const struct in6_addr *addr)
741 if (useIPv4) { 746 if (useIPv4) {
742 if (needcolon) 747 if (needcolon)
743 *p++ = ':'; 748 *p++ = ':';
744 p = ip4_string(p, &addr->s6_addr[12], false); 749 p = ip4_string(p, &in6.s6_addr[12], false);
745 } 750 }
746 751
747 *p = '\0'; 752 *p = '\0';
748 return p; 753 return p;
749} 754}
750 755
751static char *ip6_string(char *p, const struct in6_addr *addr, const char *fmt) 756static char *ip6_string(char *p, const char *addr, const char *fmt)
752{ 757{
753 int i; 758 int i;
754 for (i = 0; i < 8; i++) { 759 for (i = 0; i < 8; i++) {
755 p = pack_hex_byte(p, addr->s6_addr[2 * i]); 760 p = pack_hex_byte(p, *addr++);
756 p = pack_hex_byte(p, addr->s6_addr[2 * i + 1]); 761 p = pack_hex_byte(p, *addr++);
757 if (fmt[0] == 'I' && i != 7) 762 if (fmt[0] == 'I' && i != 7)
758 *p++ = ':'; 763 *p++ = ':';
759 } 764 }
@@ -768,9 +773,9 @@ static char *ip6_addr_string(char *buf, char *end, const u8 *addr,
768 char ip6_addr[sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:255.255.255.255")]; 773 char ip6_addr[sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:255.255.255.255")];
769 774
770 if (fmt[0] == 'I' && fmt[2] == 'c') 775 if (fmt[0] == 'I' && fmt[2] == 'c')
771 ip6_compressed_string(ip6_addr, (const struct in6_addr *)addr); 776 ip6_compressed_string(ip6_addr, addr);
772 else 777 else
773 ip6_string(ip6_addr, (const struct in6_addr *)addr, fmt); 778 ip6_string(ip6_addr, addr, fmt);
774 779
775 return string(buf, end, ip6_addr, spec); 780 return string(buf, end, ip6_addr, spec);
776} 781}
@@ -1766,7 +1771,7 @@ int vsscanf(const char * buf, const char * fmt, va_list args)
1766 * advance both strings to next white space 1771 * advance both strings to next white space
1767 */ 1772 */
1768 if (*fmt == '*') { 1773 if (*fmt == '*') {
1769 while (!isspace(*fmt) && *fmt) 1774 while (!isspace(*fmt) && *fmt != '%' && *fmt)
1770 fmt++; 1775 fmt++;
1771 while (!isspace(*str) && *str) 1776 while (!isspace(*str) && *str)
1772 str++; 1777 str++;