diff options
| author | David S. Miller <davem@davemloft.net> | 2009-09-24 18:13:11 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2009-09-24 18:13:11 -0400 |
| commit | 8b3f6af86378d0a10ca2f1ded1da124aef13b62c (patch) | |
| tree | de6ca90295730343c495be8d98be8efa322140ef /lib | |
| parent | 139d6065c83071d5f66cd013a274a43699f8e2c1 (diff) | |
| parent | 94e0fb086fc5663c38bbc0fe86d698be8314f82f (diff) | |
Merge branch 'master' of /home/davem/src/GIT/linux-2.6/
Conflicts:
drivers/staging/Kconfig
drivers/staging/Makefile
drivers/staging/cpc-usb/TODO
drivers/staging/cpc-usb/cpc-usb_drv.c
drivers/staging/cpc-usb/cpc.h
drivers/staging/cpc-usb/cpc_int.h
drivers/staging/cpc-usb/cpcusb.h
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Kconfig.debug | 25 | ||||
| -rw-r--r-- | lib/Kconfig.kmemcheck | 3 | ||||
| -rw-r--r-- | lib/decompress_inflate.c | 8 | ||||
| -rw-r--r-- | lib/decompress_unlzma.c | 10 | ||||
| -rw-r--r-- | lib/flex_array.c | 121 | ||||
| -rw-r--r-- | lib/inflate.c | 2 | ||||
| -rw-r--r-- | lib/vsprintf.c | 30 | ||||
| -rw-r--r-- | lib/zlib_deflate/deflate.c | 4 |
8 files changed, 147 insertions, 56 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 7dbd5d9c29a4..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 | ||
| 53 | config 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 | |||
| 53 | config UNUSED_SYMBOLS | 61 | config 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 |
| @@ -338,7 +346,7 @@ config SLUB_STATS | |||
| 338 | 346 | ||
| 339 | config DEBUG_KMEMLEAK | 347 | config DEBUG_KMEMLEAK |
| 340 | bool "Kernel memory leak detector" | 348 | bool "Kernel memory leak detector" |
| 341 | depends on DEBUG_KERNEL && EXPERIMENTAL && (X86 || ARM) && \ | 349 | depends on DEBUG_KERNEL && EXPERIMENTAL && (X86 || ARM || PPC) && \ |
| 342 | !MEMORY_HOTPLUG | 350 | !MEMORY_HOTPLUG |
| 343 | select DEBUG_FS if SYSFS | 351 | select DEBUG_FS if SYSFS |
| 344 | select STACKTRACE if STACKTRACE_SUPPORT | 352 | select STACKTRACE if STACKTRACE_SUPPORT |
| @@ -805,6 +813,21 @@ config DEBUG_BLOCK_EXT_DEVT | |||
| 805 | 813 | ||
| 806 | Say N if you are unsure. | 814 | Say N if you are unsure. |
| 807 | 815 | ||
| 816 | config DEBUG_FORCE_WEAK_PER_CPU | ||
| 817 | bool "Force weak per-cpu definitions" | ||
| 818 | depends on DEBUG_KERNEL | ||
| 819 | help | ||
| 820 | s390 and alpha require percpu variables in modules to be | ||
| 821 | defined weak to work around addressing range issue which | ||
| 822 | puts the following two restrictions on percpu variable | ||
| 823 | definitions. | ||
| 824 | |||
| 825 | 1. percpu symbols must be unique whether static or not | ||
| 826 | 2. percpu variables can't be defined inside a function | ||
| 827 | |||
| 828 | To ensure that generic code follows the above rules, this | ||
| 829 | option forces all percpu variables to be defined as weak. | ||
| 830 | |||
| 808 | config LKDTM | 831 | config LKDTM |
| 809 | tristate "Linux Kernel Dump Test Tool Module" | 832 | tristate "Linux Kernel Dump Test Tool Module" |
| 810 | depends on DEBUG_KERNEL | 833 | depends on DEBUG_KERNEL |
diff --git a/lib/Kconfig.kmemcheck b/lib/Kconfig.kmemcheck index 603c81b66549..846e039a86b4 100644 --- a/lib/Kconfig.kmemcheck +++ b/lib/Kconfig.kmemcheck | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | config HAVE_ARCH_KMEMCHECK | 1 | config HAVE_ARCH_KMEMCHECK |
| 2 | bool | 2 | bool |
| 3 | 3 | ||
| 4 | if HAVE_ARCH_KMEMCHECK | ||
| 5 | |||
| 4 | menuconfig KMEMCHECK | 6 | menuconfig KMEMCHECK |
| 5 | bool "kmemcheck: trap use of uninitialized memory" | 7 | bool "kmemcheck: trap use of uninitialized memory" |
| 6 | depends on DEBUG_KERNEL | 8 | depends on DEBUG_KERNEL |
| @@ -89,3 +91,4 @@ config KMEMCHECK_BITOPS_OK | |||
| 89 | accesses where not all the bits are initialized at the same time. | 91 | accesses where not all the bits are initialized at the same time. |
| 90 | This may also hide some real bugs. | 92 | This may also hide some real bugs. |
| 91 | 93 | ||
| 94 | endif | ||
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 | ||
| 30 | static 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 */ |
| 31 | STATIC int INIT gunzip(unsigned char *buf, int len, | 36 | STATIC 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 | ||
| 85 | static 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() */ |
| 86 | static void INIT rc_read(struct rc *rc) | 91 | static 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/flex_array.c b/lib/flex_array.c index 7baed2fc3bc8..66eef2e4483e 100644 --- a/lib/flex_array.c +++ b/lib/flex_array.c | |||
| @@ -28,23 +28,6 @@ struct flex_array_part { | |||
| 28 | char elements[FLEX_ARRAY_PART_SIZE]; | 28 | char elements[FLEX_ARRAY_PART_SIZE]; |
| 29 | }; | 29 | }; |
| 30 | 30 | ||
| 31 | static inline int __elements_per_part(int element_size) | ||
| 32 | { | ||
| 33 | return FLEX_ARRAY_PART_SIZE / element_size; | ||
| 34 | } | ||
| 35 | |||
| 36 | static inline int bytes_left_in_base(void) | ||
| 37 | { | ||
| 38 | int element_offset = offsetof(struct flex_array, parts); | ||
| 39 | int bytes_left = FLEX_ARRAY_BASE_SIZE - element_offset; | ||
| 40 | return bytes_left; | ||
| 41 | } | ||
| 42 | |||
| 43 | static inline int nr_base_part_ptrs(void) | ||
| 44 | { | ||
| 45 | return bytes_left_in_base() / sizeof(struct flex_array_part *); | ||
| 46 | } | ||
| 47 | |||
| 48 | /* | 31 | /* |
| 49 | * If a user requests an allocation which is small | 32 | * If a user requests an allocation which is small |
| 50 | * enough, we may simply use the space in the | 33 | * enough, we may simply use the space in the |
| @@ -54,7 +37,7 @@ static inline int nr_base_part_ptrs(void) | |||
| 54 | static inline int elements_fit_in_base(struct flex_array *fa) | 37 | static inline int elements_fit_in_base(struct flex_array *fa) |
| 55 | { | 38 | { |
| 56 | int data_size = fa->element_size * fa->total_nr_elements; | 39 | int data_size = fa->element_size * fa->total_nr_elements; |
| 57 | if (data_size <= bytes_left_in_base()) | 40 | if (data_size <= FLEX_ARRAY_BASE_BYTES_LEFT) |
| 58 | return 1; | 41 | return 1; |
| 59 | return 0; | 42 | return 0; |
| 60 | } | 43 | } |
| @@ -63,6 +46,7 @@ static inline int elements_fit_in_base(struct flex_array *fa) | |||
| 63 | * flex_array_alloc - allocate a new flexible array | 46 | * flex_array_alloc - allocate a new flexible array |
| 64 | * @element_size: the size of individual elements in the array | 47 | * @element_size: the size of individual elements in the array |
| 65 | * @total: total number of elements that this should hold | 48 | * @total: total number of elements that this should hold |
| 49 | * @flags: page allocation flags to use for base array | ||
| 66 | * | 50 | * |
| 67 | * Note: all locking must be provided by the caller. | 51 | * Note: all locking must be provided by the caller. |
| 68 | * | 52 | * |
| @@ -103,7 +87,8 @@ struct flex_array *flex_array_alloc(int element_size, unsigned int total, | |||
| 103 | gfp_t flags) | 87 | gfp_t flags) |
| 104 | { | 88 | { |
| 105 | struct flex_array *ret; | 89 | struct flex_array *ret; |
| 106 | int max_size = nr_base_part_ptrs() * __elements_per_part(element_size); | 90 | int max_size = FLEX_ARRAY_NR_BASE_PTRS * |
| 91 | FLEX_ARRAY_ELEMENTS_PER_PART(element_size); | ||
| 107 | 92 | ||
| 108 | /* max_size will end up 0 if element_size > PAGE_SIZE */ | 93 | /* max_size will end up 0 if element_size > PAGE_SIZE */ |
| 109 | if (total > max_size) | 94 | if (total > max_size) |
| @@ -113,17 +98,21 @@ struct flex_array *flex_array_alloc(int element_size, unsigned int total, | |||
| 113 | return NULL; | 98 | return NULL; |
| 114 | ret->element_size = element_size; | 99 | ret->element_size = element_size; |
| 115 | ret->total_nr_elements = total; | 100 | ret->total_nr_elements = total; |
| 101 | if (elements_fit_in_base(ret) && !(flags & __GFP_ZERO)) | ||
| 102 | memset(ret->parts[0], FLEX_ARRAY_FREE, | ||
| 103 | FLEX_ARRAY_BASE_BYTES_LEFT); | ||
| 116 | return ret; | 104 | return ret; |
| 117 | } | 105 | } |
| 118 | 106 | ||
| 119 | static int fa_element_to_part_nr(struct flex_array *fa, | 107 | static int fa_element_to_part_nr(struct flex_array *fa, |
| 120 | unsigned int element_nr) | 108 | unsigned int element_nr) |
| 121 | { | 109 | { |
| 122 | return element_nr / __elements_per_part(fa->element_size); | 110 | return element_nr / FLEX_ARRAY_ELEMENTS_PER_PART(fa->element_size); |
| 123 | } | 111 | } |
| 124 | 112 | ||
| 125 | /** | 113 | /** |
| 126 | * flex_array_free_parts - just free the second-level pages | 114 | * flex_array_free_parts - just free the second-level pages |
| 115 | * @fa: the flex array from which to free parts | ||
| 127 | * | 116 | * |
| 128 | * This is to be used in cases where the base 'struct flex_array' | 117 | * This is to be used in cases where the base 'struct flex_array' |
| 129 | * has been statically allocated and should not be free. | 118 | * has been statically allocated and should not be free. |
| @@ -131,11 +120,10 @@ static int fa_element_to_part_nr(struct flex_array *fa, | |||
| 131 | void flex_array_free_parts(struct flex_array *fa) | 120 | void flex_array_free_parts(struct flex_array *fa) |
| 132 | { | 121 | { |
| 133 | int part_nr; | 122 | int part_nr; |
| 134 | int max_part = nr_base_part_ptrs(); | ||
| 135 | 123 | ||
| 136 | if (elements_fit_in_base(fa)) | 124 | if (elements_fit_in_base(fa)) |
| 137 | return; | 125 | return; |
| 138 | for (part_nr = 0; part_nr < max_part; part_nr++) | 126 | for (part_nr = 0; part_nr < FLEX_ARRAY_NR_BASE_PTRS; part_nr++) |
| 139 | kfree(fa->parts[part_nr]); | 127 | kfree(fa->parts[part_nr]); |
| 140 | } | 128 | } |
| 141 | 129 | ||
| @@ -150,7 +138,8 @@ static unsigned int index_inside_part(struct flex_array *fa, | |||
| 150 | { | 138 | { |
| 151 | unsigned int part_offset; | 139 | unsigned int part_offset; |
| 152 | 140 | ||
| 153 | part_offset = element_nr % __elements_per_part(fa->element_size); | 141 | part_offset = element_nr % |
| 142 | FLEX_ARRAY_ELEMENTS_PER_PART(fa->element_size); | ||
| 154 | return part_offset * fa->element_size; | 143 | return part_offset * fa->element_size; |
| 155 | } | 144 | } |
| 156 | 145 | ||
| @@ -159,15 +148,12 @@ __fa_get_part(struct flex_array *fa, int part_nr, gfp_t flags) | |||
| 159 | { | 148 | { |
| 160 | struct flex_array_part *part = fa->parts[part_nr]; | 149 | struct flex_array_part *part = fa->parts[part_nr]; |
| 161 | if (!part) { | 150 | if (!part) { |
| 162 | /* | 151 | part = kmalloc(sizeof(struct flex_array_part), flags); |
| 163 | * This leaves the part pages uninitialized | ||
| 164 | * and with potentially random data, just | ||
| 165 | * as if the user had kmalloc()'d the whole. | ||
| 166 | * __GFP_ZERO can be used to zero it. | ||
| 167 | */ | ||
| 168 | part = kmalloc(FLEX_ARRAY_PART_SIZE, flags); | ||
| 169 | if (!part) | 152 | if (!part) |
| 170 | return NULL; | 153 | return NULL; |
| 154 | if (!(flags & __GFP_ZERO)) | ||
| 155 | memset(part, FLEX_ARRAY_FREE, | ||
| 156 | sizeof(struct flex_array_part)); | ||
| 171 | fa->parts[part_nr] = part; | 157 | fa->parts[part_nr] = part; |
| 172 | } | 158 | } |
| 173 | return part; | 159 | return part; |
| @@ -175,9 +161,12 @@ __fa_get_part(struct flex_array *fa, int part_nr, gfp_t flags) | |||
| 175 | 161 | ||
| 176 | /** | 162 | /** |
| 177 | * flex_array_put - copy data into the array at @element_nr | 163 | * flex_array_put - copy data into the array at @element_nr |
| 178 | * @src: address of data to copy into the array | 164 | * @fa: the flex array to copy data into |
| 179 | * @element_nr: index of the position in which to insert | 165 | * @element_nr: index of the position in which to insert |
| 180 | * the new element. | 166 | * the new element. |
| 167 | * @src: address of data to copy into the array | ||
| 168 | * @flags: page allocation flags to use for array expansion | ||
| 169 | * | ||
| 181 | * | 170 | * |
| 182 | * Note that this *copies* the contents of @src into | 171 | * Note that this *copies* the contents of @src into |
| 183 | * the array. If you are trying to store an array of | 172 | * the array. If you are trying to store an array of |
| @@ -207,9 +196,38 @@ int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src, | |||
| 207 | } | 196 | } |
| 208 | 197 | ||
| 209 | /** | 198 | /** |
| 199 | * flex_array_clear - clear element in array at @element_nr | ||
| 200 | * @fa: the flex array of the element. | ||
| 201 | * @element_nr: index of the position to clear. | ||
| 202 | * | ||
| 203 | * Locking must be provided by the caller. | ||
| 204 | */ | ||
| 205 | int flex_array_clear(struct flex_array *fa, unsigned int element_nr) | ||
| 206 | { | ||
| 207 | int part_nr = fa_element_to_part_nr(fa, element_nr); | ||
| 208 | struct flex_array_part *part; | ||
| 209 | void *dst; | ||
| 210 | |||
| 211 | if (element_nr >= fa->total_nr_elements) | ||
| 212 | return -ENOSPC; | ||
| 213 | if (elements_fit_in_base(fa)) | ||
| 214 | part = (struct flex_array_part *)&fa->parts[0]; | ||
| 215 | else { | ||
| 216 | part = fa->parts[part_nr]; | ||
| 217 | if (!part) | ||
| 218 | return -EINVAL; | ||
| 219 | } | ||
| 220 | dst = &part->elements[index_inside_part(fa, element_nr)]; | ||
| 221 | memset(dst, FLEX_ARRAY_FREE, fa->element_size); | ||
| 222 | return 0; | ||
| 223 | } | ||
| 224 | |||
| 225 | /** | ||
| 210 | * flex_array_prealloc - guarantee that array space exists | 226 | * flex_array_prealloc - guarantee that array space exists |
| 227 | * @fa: the flex array for which to preallocate parts | ||
| 211 | * @start: index of first array element for which space is allocated | 228 | * @start: index of first array element for which space is allocated |
| 212 | * @end: index of last (inclusive) element for which space is allocated | 229 | * @end: index of last (inclusive) element for which space is allocated |
| 230 | * @flags: page allocation flags | ||
| 213 | * | 231 | * |
| 214 | * This will guarantee that no future calls to flex_array_put() | 232 | * This will guarantee that no future calls to flex_array_put() |
| 215 | * will allocate memory. It can be used if you are expecting to | 233 | * will allocate memory. It can be used if you are expecting to |
| @@ -242,6 +260,7 @@ int flex_array_prealloc(struct flex_array *fa, unsigned int start, | |||
| 242 | 260 | ||
| 243 | /** | 261 | /** |
| 244 | * flex_array_get - pull data back out of the array | 262 | * flex_array_get - pull data back out of the array |
| 263 | * @fa: the flex array from which to extract data | ||
| 245 | * @element_nr: index of the element to fetch from the array | 264 | * @element_nr: index of the element to fetch from the array |
| 246 | * | 265 | * |
| 247 | * Returns a pointer to the data at index @element_nr. Note | 266 | * Returns a pointer to the data at index @element_nr. Note |
| @@ -266,3 +285,43 @@ void *flex_array_get(struct flex_array *fa, unsigned int element_nr) | |||
| 266 | } | 285 | } |
| 267 | return &part->elements[index_inside_part(fa, element_nr)]; | 286 | return &part->elements[index_inside_part(fa, element_nr)]; |
| 268 | } | 287 | } |
| 288 | |||
| 289 | static int part_is_free(struct flex_array_part *part) | ||
| 290 | { | ||
| 291 | int i; | ||
| 292 | |||
| 293 | for (i = 0; i < sizeof(struct flex_array_part); i++) | ||
| 294 | if (part->elements[i] != FLEX_ARRAY_FREE) | ||
| 295 | return 0; | ||
| 296 | return 1; | ||
| 297 | } | ||
| 298 | |||
| 299 | /** | ||
| 300 | * flex_array_shrink - free unused second-level pages | ||
| 301 | * @fa: the flex array to shrink | ||
| 302 | * | ||
| 303 | * Frees all second-level pages that consist solely of unused | ||
| 304 | * elements. Returns the number of pages freed. | ||
| 305 | * | ||
| 306 | * Locking must be provided by the caller. | ||
| 307 | */ | ||
| 308 | int flex_array_shrink(struct flex_array *fa) | ||
| 309 | { | ||
| 310 | struct flex_array_part *part; | ||
| 311 | int part_nr; | ||
| 312 | int ret = 0; | ||
| 313 | |||
| 314 | if (elements_fit_in_base(fa)) | ||
| 315 | return ret; | ||
| 316 | for (part_nr = 0; part_nr < FLEX_ARRAY_NR_BASE_PTRS; part_nr++) { | ||
| 317 | part = fa->parts[part_nr]; | ||
| 318 | if (!part) | ||
| 319 | continue; | ||
| 320 | if (part_is_free(part)) { | ||
| 321 | fa->parts[part_nr] = NULL; | ||
| 322 | kfree(part); | ||
| 323 | ret++; | ||
| 324 | } | ||
| 325 | } | ||
| 326 | return ret; | ||
| 327 | } | ||
diff --git a/lib/inflate.c b/lib/inflate.c index 1a8e8a978128..d10255973a9f 100644 --- a/lib/inflate.c +++ b/lib/inflate.c | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | * Adapted for booting Linux by Hannu Savolainen 1993 | 7 | * Adapted for booting Linux by Hannu Savolainen 1993 |
| 8 | * based on gzip-1.0.3 | 8 | * based on gzip-1.0.3 |
| 9 | * | 9 | * |
| 10 | * Nicolas Pitre <nico@cam.org>, 1999/04/14 : | 10 | * Nicolas Pitre <nico@fluxnic.net>, 1999/04/14 : |
| 11 | * Little mods for all variable to reside either into rodata or bss segments | 11 | * Little mods for all variable to reside either into rodata or bss segments |
| 12 | * by marking constant variables with 'const' and initializing all the others | 12 | * by marking constant variables with 'const' and initializing all the others |
| 13 | * at run-time only. This allows for the kernel uncompressor to run | 13 | * at run-time only. This allows for the kernel uncompressor to run |
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index a1941f8d205f..b91839e9e892 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c | |||
| @@ -581,7 +581,7 @@ static char *symbol_string(char *buf, char *end, void *ptr, | |||
| 581 | unsigned long value = (unsigned long) ptr; | 581 | unsigned long value = (unsigned long) ptr; |
| 582 | #ifdef CONFIG_KALLSYMS | 582 | #ifdef CONFIG_KALLSYMS |
| 583 | char sym[KSYM_SYMBOL_LEN]; | 583 | char sym[KSYM_SYMBOL_LEN]; |
| 584 | if (ext != 'f') | 584 | if (ext != 'f' && ext != 's') |
| 585 | sprint_symbol(sym, value); | 585 | sprint_symbol(sym, value); |
| 586 | else | 586 | else |
| 587 | kallsyms_lookup(value, NULL, NULL, NULL, sym); | 587 | kallsyms_lookup(value, NULL, NULL, NULL, sym); |
| @@ -799,7 +799,8 @@ static char *ip4_addr_string(char *buf, char *end, const u8 *addr, | |||
| 799 | * | 799 | * |
| 800 | * - 'F' For symbolic function descriptor pointers with offset | 800 | * - 'F' For symbolic function descriptor pointers with offset |
| 801 | * - 'f' For simple symbolic function names without offset | 801 | * - 'f' For simple symbolic function names without offset |
| 802 | * - 'S' For symbolic direct pointers | 802 | * - 'S' For symbolic direct pointers with offset |
| 803 | * - 's' For symbolic direct pointers without offset | ||
| 803 | * - 'R' For a struct resource pointer, it prints the range of | 804 | * - 'R' For a struct resource pointer, it prints the range of |
| 804 | * addresses (not the name nor the flags) | 805 | * addresses (not the name nor the flags) |
| 805 | * - 'M' For a 6-byte MAC address, it prints the address in the | 806 | * - 'M' For a 6-byte MAC address, it prints the address in the |
| @@ -827,6 +828,7 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr, | |||
| 827 | case 'F': | 828 | case 'F': |
| 828 | case 'f': | 829 | case 'f': |
| 829 | ptr = dereference_function_descriptor(ptr); | 830 | ptr = dereference_function_descriptor(ptr); |
| 831 | case 's': | ||
| 830 | /* Fallthrough */ | 832 | /* Fallthrough */ |
| 831 | case 'S': | 833 | case 'S': |
| 832 | return symbol_string(buf, end, ptr, spec, *fmt); | 834 | return symbol_string(buf, end, ptr, spec, *fmt); |
| @@ -1068,10 +1070,12 @@ qualifier: | |||
| 1068 | * @args: Arguments for the format string | 1070 | * @args: Arguments for the format string |
| 1069 | * | 1071 | * |
| 1070 | * This function follows C99 vsnprintf, but has some extensions: | 1072 | * This function follows C99 vsnprintf, but has some extensions: |
| 1071 | * %pS output the name of a text symbol | 1073 | * %pS output the name of a text symbol with offset |
| 1074 | * %ps output the name of a text symbol without offset | ||
| 1072 | * %pF output the name of a function pointer with its offset | 1075 | * %pF output the name of a function pointer with its offset |
| 1073 | * %pf output the name of a function pointer without its offset | 1076 | * %pf output the name of a function pointer without its offset |
| 1074 | * %pR output the address range in a struct resource | 1077 | * %pR output the address range in a struct resource |
| 1078 | * %n is ignored | ||
| 1075 | * | 1079 | * |
| 1076 | * The return value is the number of characters which would | 1080 | * The return value is the number of characters which would |
| 1077 | * be generated for the given input, excluding the trailing | 1081 | * be generated for the given input, excluding the trailing |
| @@ -1093,13 +1097,8 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) | |||
| 1093 | 1097 | ||
| 1094 | /* Reject out-of-range values early. Large positive sizes are | 1098 | /* Reject out-of-range values early. Large positive sizes are |
| 1095 | used for unknown buffer sizes. */ | 1099 | used for unknown buffer sizes. */ |
| 1096 | if (unlikely((int) size < 0)) { | 1100 | if (WARN_ON_ONCE((int) size < 0)) |
| 1097 | /* There can be only one.. */ | ||
| 1098 | static char warn = 1; | ||
| 1099 | WARN_ON(warn); | ||
| 1100 | warn = 0; | ||
| 1101 | return 0; | 1101 | return 0; |
| 1102 | } | ||
| 1103 | 1102 | ||
| 1104 | str = buf; | 1103 | str = buf; |
| 1105 | end = buf + size; | 1104 | end = buf + size; |
| @@ -1527,11 +1526,7 @@ EXPORT_SYMBOL_GPL(vbin_printf); | |||
| 1527 | * a binary buffer that generated by vbin_printf. | 1526 | * a binary buffer that generated by vbin_printf. |
| 1528 | * | 1527 | * |
| 1529 | * The format follows C99 vsnprintf, but has some extensions: | 1528 | * The format follows C99 vsnprintf, but has some extensions: |
| 1530 | * %pS output the name of a text symbol | 1529 | * see vsnprintf comment for details. |
| 1531 | * %pF output the name of a function pointer with its offset | ||
| 1532 | * %pf output the name of a function pointer without its offset | ||
| 1533 | * %pR output the address range in a struct resource | ||
| 1534 | * %n is ignored | ||
| 1535 | * | 1530 | * |
| 1536 | * The return value is the number of characters which would | 1531 | * The return value is the number of characters which would |
| 1537 | * be generated for the given input, excluding the trailing | 1532 | * be generated for the given input, excluding the trailing |
| @@ -1549,13 +1544,8 @@ int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf) | |||
| 1549 | 1544 | ||
| 1550 | struct printf_spec spec = {0}; | 1545 | struct printf_spec spec = {0}; |
| 1551 | 1546 | ||
| 1552 | if (unlikely((int) size < 0)) { | 1547 | if (WARN_ON_ONCE((int) size < 0)) |
| 1553 | /* There can be only one.. */ | ||
| 1554 | static char warn = 1; | ||
| 1555 | WARN_ON(warn); | ||
| 1556 | warn = 0; | ||
| 1557 | return 0; | 1548 | return 0; |
| 1558 | } | ||
| 1559 | 1549 | ||
| 1560 | str = buf; | 1550 | str = buf; |
| 1561 | end = buf + size; | 1551 | end = buf + size; |
diff --git a/lib/zlib_deflate/deflate.c b/lib/zlib_deflate/deflate.c index c3e4a2baf835..46a31e5f49c3 100644 --- a/lib/zlib_deflate/deflate.c +++ b/lib/zlib_deflate/deflate.c | |||
| @@ -135,7 +135,7 @@ static const config configuration_table[10] = { | |||
| 135 | 135 | ||
| 136 | /* =========================================================================== | 136 | /* =========================================================================== |
| 137 | * Update a hash value with the given input byte | 137 | * Update a hash value with the given input byte |
| 138 | * IN assertion: all calls to to UPDATE_HASH are made with consecutive | 138 | * IN assertion: all calls to UPDATE_HASH are made with consecutive |
| 139 | * input characters, so that a running hash key can be computed from the | 139 | * input characters, so that a running hash key can be computed from the |
| 140 | * previous key instead of complete recalculation each time. | 140 | * previous key instead of complete recalculation each time. |
| 141 | */ | 141 | */ |
| @@ -146,7 +146,7 @@ static const config configuration_table[10] = { | |||
| 146 | * Insert string str in the dictionary and set match_head to the previous head | 146 | * Insert string str in the dictionary and set match_head to the previous head |
| 147 | * of the hash chain (the most recent string with same hash key). Return | 147 | * of the hash chain (the most recent string with same hash key). Return |
| 148 | * the previous length of the hash chain. | 148 | * the previous length of the hash chain. |
| 149 | * IN assertion: all calls to to INSERT_STRING are made with consecutive | 149 | * IN assertion: all calls to INSERT_STRING are made with consecutive |
| 150 | * input characters and the first MIN_MATCH bytes of str are valid | 150 | * input characters and the first MIN_MATCH bytes of str are valid |
| 151 | * (except for the last MIN_MATCH-1 bytes of the input file). | 151 | * (except for the last MIN_MATCH-1 bytes of the input file). |
| 152 | */ | 152 | */ |
