aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Kconfig.debug16
-rw-r--r--lib/Kconfig.kasan4
-rw-r--r--lib/decompress.c5
-rw-r--r--lib/dma-debug.c3
-rw-r--r--lib/hexdump.c7
-rw-r--r--lib/iommu-common.c2
-rw-r--r--lib/kobject.c5
-rw-r--r--lib/mpi/mpicoder.c38
-rw-r--r--lib/pci_iomap.c66
-rw-r--r--lib/rhashtable.c4
-rw-r--r--lib/vsprintf.c1
11 files changed, 110 insertions, 41 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index e2894b23efb6..3e0b662cae09 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -1353,20 +1353,6 @@ config RCU_CPU_STALL_TIMEOUT
1353 RCU grace period persists, additional CPU stall warnings are 1353 RCU grace period persists, additional CPU stall warnings are
1354 printed at more widely spaced intervals. 1354 printed at more widely spaced intervals.
1355 1355
1356config RCU_CPU_STALL_INFO
1357 bool "Print additional diagnostics on RCU CPU stall"
1358 depends on (TREE_RCU || PREEMPT_RCU) && DEBUG_KERNEL
1359 default y
1360 help
1361 For each stalled CPU that is aware of the current RCU grace
1362 period, print out additional per-CPU diagnostic information
1363 regarding scheduling-clock ticks, idle state, and,
1364 for RCU_FAST_NO_HZ kernels, idle-entry state.
1365
1366 Say N if you are unsure.
1367
1368 Say Y if you want to enable such diagnostics.
1369
1370config RCU_TRACE 1356config RCU_TRACE
1371 bool "Enable tracing for RCU" 1357 bool "Enable tracing for RCU"
1372 depends on DEBUG_KERNEL 1358 depends on DEBUG_KERNEL
@@ -1379,7 +1365,7 @@ config RCU_TRACE
1379 Say N if you are unsure. 1365 Say N if you are unsure.
1380 1366
1381config RCU_EQS_DEBUG 1367config RCU_EQS_DEBUG
1382 bool "Use this when adding any sort of NO_HZ support to your arch" 1368 bool "Provide debugging asserts for adding NO_HZ support to an arch"
1383 depends on DEBUG_KERNEL 1369 depends on DEBUG_KERNEL
1384 help 1370 help
1385 This option provides consistency checks in RCU's handling of 1371 This option provides consistency checks in RCU's handling of
diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan
index 777eda7d1ab4..39f24d6721e5 100644
--- a/lib/Kconfig.kasan
+++ b/lib/Kconfig.kasan
@@ -18,10 +18,6 @@ config KASAN
18 For better error detection enable CONFIG_STACKTRACE, 18 For better error detection enable CONFIG_STACKTRACE,
19 and add slub_debug=U to boot cmdline. 19 and add slub_debug=U to boot cmdline.
20 20
21config KASAN_SHADOW_OFFSET
22 hex
23 default 0xdffffc0000000000 if X86_64
24
25choice 21choice
26 prompt "Instrumentation type" 22 prompt "Instrumentation type"
27 depends on KASAN 23 depends on KASAN
diff --git a/lib/decompress.c b/lib/decompress.c
index 528ff932d8e4..62696dff5730 100644
--- a/lib/decompress.c
+++ b/lib/decompress.c
@@ -59,8 +59,11 @@ decompress_fn __init decompress_method(const unsigned char *inbuf, long len,
59{ 59{
60 const struct compress_format *cf; 60 const struct compress_format *cf;
61 61
62 if (len < 2) 62 if (len < 2) {
63 if (name)
64 *name = NULL;
63 return NULL; /* Need at least this much... */ 65 return NULL; /* Need at least this much... */
66 }
64 67
65 pr_debug("Compressed data magic: %#.2x %#.2x\n", inbuf[0], inbuf[1]); 68 pr_debug("Compressed data magic: %#.2x %#.2x\n", inbuf[0], inbuf[1]);
66 69
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index ae4b65e17e64..dace71fe41f7 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -574,6 +574,9 @@ void debug_dma_assert_idle(struct page *page)
574 unsigned long flags; 574 unsigned long flags;
575 phys_addr_t cln; 575 phys_addr_t cln;
576 576
577 if (dma_debug_disabled())
578 return;
579
577 if (!page) 580 if (!page)
578 return; 581 return;
579 582
diff --git a/lib/hexdump.c b/lib/hexdump.c
index 7ea09699855d..8d74c20d8595 100644
--- a/lib/hexdump.c
+++ b/lib/hexdump.c
@@ -11,6 +11,7 @@
11#include <linux/ctype.h> 11#include <linux/ctype.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/export.h> 13#include <linux/export.h>
14#include <asm/unaligned.h>
14 15
15const char hex_asc[] = "0123456789abcdef"; 16const char hex_asc[] = "0123456789abcdef";
16EXPORT_SYMBOL(hex_asc); 17EXPORT_SYMBOL(hex_asc);
@@ -139,7 +140,7 @@ int hex_dump_to_buffer(const void *buf, size_t len, int rowsize, int groupsize,
139 for (j = 0; j < ngroups; j++) { 140 for (j = 0; j < ngroups; j++) {
140 ret = snprintf(linebuf + lx, linebuflen - lx, 141 ret = snprintf(linebuf + lx, linebuflen - lx,
141 "%s%16.16llx", j ? " " : "", 142 "%s%16.16llx", j ? " " : "",
142 (unsigned long long)*(ptr8 + j)); 143 get_unaligned(ptr8 + j));
143 if (ret >= linebuflen - lx) 144 if (ret >= linebuflen - lx)
144 goto overflow1; 145 goto overflow1;
145 lx += ret; 146 lx += ret;
@@ -150,7 +151,7 @@ int hex_dump_to_buffer(const void *buf, size_t len, int rowsize, int groupsize,
150 for (j = 0; j < ngroups; j++) { 151 for (j = 0; j < ngroups; j++) {
151 ret = snprintf(linebuf + lx, linebuflen - lx, 152 ret = snprintf(linebuf + lx, linebuflen - lx,
152 "%s%8.8x", j ? " " : "", 153 "%s%8.8x", j ? " " : "",
153 *(ptr4 + j)); 154 get_unaligned(ptr4 + j));
154 if (ret >= linebuflen - lx) 155 if (ret >= linebuflen - lx)
155 goto overflow1; 156 goto overflow1;
156 lx += ret; 157 lx += ret;
@@ -161,7 +162,7 @@ int hex_dump_to_buffer(const void *buf, size_t len, int rowsize, int groupsize,
161 for (j = 0; j < ngroups; j++) { 162 for (j = 0; j < ngroups; j++) {
162 ret = snprintf(linebuf + lx, linebuflen - lx, 163 ret = snprintf(linebuf + lx, linebuflen - lx,
163 "%s%4.4x", j ? " " : "", 164 "%s%4.4x", j ? " " : "",
164 *(ptr2 + j)); 165 get_unaligned(ptr2 + j));
165 if (ret >= linebuflen - lx) 166 if (ret >= linebuflen - lx)
166 goto overflow1; 167 goto overflow1;
167 lx += ret; 168 lx += ret;
diff --git a/lib/iommu-common.c b/lib/iommu-common.c
index df30632f0bef..ff19f66d3f7f 100644
--- a/lib/iommu-common.c
+++ b/lib/iommu-common.c
@@ -119,7 +119,7 @@ unsigned long iommu_tbl_range_alloc(struct device *dev,
119 unsigned long align_mask = 0; 119 unsigned long align_mask = 0;
120 120
121 if (align_order > 0) 121 if (align_order > 0)
122 align_mask = 0xffffffffffffffffl >> (64 - align_order); 122 align_mask = ~0ul >> (BITS_PER_LONG - align_order);
123 123
124 /* Sanity check */ 124 /* Sanity check */
125 if (unlikely(npages == 0)) { 125 if (unlikely(npages == 0)) {
diff --git a/lib/kobject.c b/lib/kobject.c
index 2e3bd01964a9..3e3a5c3cb330 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -337,8 +337,9 @@ error:
337} 337}
338EXPORT_SYMBOL(kobject_init); 338EXPORT_SYMBOL(kobject_init);
339 339
340static int kobject_add_varg(struct kobject *kobj, struct kobject *parent, 340static __printf(3, 0) int kobject_add_varg(struct kobject *kobj,
341 const char *fmt, va_list vargs) 341 struct kobject *parent,
342 const char *fmt, va_list vargs)
342{ 343{
343 int retval; 344 int retval;
344 345
diff --git a/lib/mpi/mpicoder.c b/lib/mpi/mpicoder.c
index bc0a1da8afba..95c52a95259e 100644
--- a/lib/mpi/mpicoder.c
+++ b/lib/mpi/mpicoder.c
@@ -146,18 +146,25 @@ int mpi_read_buffer(MPI a, uint8_t *buf, unsigned buf_len, unsigned *nbytes,
146 uint8_t *p; 146 uint8_t *p;
147 mpi_limb_t alimb; 147 mpi_limb_t alimb;
148 unsigned int n = mpi_get_size(a); 148 unsigned int n = mpi_get_size(a);
149 int i; 149 int i, lzeros = 0;
150 150
151 if (buf_len < n || !buf) 151 if (buf_len < n || !buf || !nbytes)
152 return -EINVAL; 152 return -EINVAL;
153 153
154 if (sign) 154 if (sign)
155 *sign = a->sign; 155 *sign = a->sign;
156 156
157 if (nbytes) 157 p = (void *)&a->d[a->nlimbs] - 1;
158 *nbytes = n; 158
159 for (i = a->nlimbs * sizeof(alimb) - 1; i >= 0; i--, p--) {
160 if (!*p)
161 lzeros++;
162 else
163 break;
164 }
159 165
160 p = buf; 166 p = buf;
167 *nbytes = n - lzeros;
161 168
162 for (i = a->nlimbs - 1; i >= 0; i--) { 169 for (i = a->nlimbs - 1; i >= 0; i--) {
163 alimb = a->d[i]; 170 alimb = a->d[i];
@@ -178,6 +185,19 @@ int mpi_read_buffer(MPI a, uint8_t *buf, unsigned buf_len, unsigned *nbytes,
178#else 185#else
179#error please implement for this limb size. 186#error please implement for this limb size.
180#endif 187#endif
188
189 if (lzeros > 0) {
190 if (lzeros >= sizeof(alimb)) {
191 p -= sizeof(alimb);
192 } else {
193 mpi_limb_t *limb1 = (void *)p - sizeof(alimb);
194 mpi_limb_t *limb2 = (void *)p - sizeof(alimb)
195 + lzeros;
196 *limb1 = *limb2;
197 p -= lzeros;
198 }
199 lzeros -= sizeof(alimb);
200 }
181 } 201 }
182 return 0; 202 return 0;
183} 203}
@@ -197,7 +217,7 @@ EXPORT_SYMBOL_GPL(mpi_read_buffer);
197 */ 217 */
198void *mpi_get_buffer(MPI a, unsigned *nbytes, int *sign) 218void *mpi_get_buffer(MPI a, unsigned *nbytes, int *sign)
199{ 219{
200 uint8_t *buf, *p; 220 uint8_t *buf;
201 unsigned int n; 221 unsigned int n;
202 int ret; 222 int ret;
203 223
@@ -220,14 +240,6 @@ void *mpi_get_buffer(MPI a, unsigned *nbytes, int *sign)
220 kfree(buf); 240 kfree(buf);
221 return NULL; 241 return NULL;
222 } 242 }
223
224 /* this is sub-optimal but we need to do the shift operation
225 * because the caller has to free the returned buffer */
226 for (p = buf; !*p && *nbytes; p++, --*nbytes)
227 ;
228 if (p != buf)
229 memmove(buf, p, *nbytes);
230
231 return buf; 243 return buf;
232} 244}
233EXPORT_SYMBOL_GPL(mpi_get_buffer); 245EXPORT_SYMBOL_GPL(mpi_get_buffer);
diff --git a/lib/pci_iomap.c b/lib/pci_iomap.c
index bcce5f149310..5f5d24d1d53f 100644
--- a/lib/pci_iomap.c
+++ b/lib/pci_iomap.c
@@ -52,6 +52,51 @@ void __iomem *pci_iomap_range(struct pci_dev *dev,
52EXPORT_SYMBOL(pci_iomap_range); 52EXPORT_SYMBOL(pci_iomap_range);
53 53
54/** 54/**
55 * pci_iomap_wc_range - create a virtual WC mapping cookie for a PCI BAR
56 * @dev: PCI device that owns the BAR
57 * @bar: BAR number
58 * @offset: map memory at the given offset in BAR
59 * @maxlen: max length of the memory to map
60 *
61 * Using this function you will get a __iomem address to your device BAR.
62 * You can access it using ioread*() and iowrite*(). These functions hide
63 * the details if this is a MMIO or PIO address space and will just do what
64 * you expect from them in the correct way. When possible write combining
65 * is used.
66 *
67 * @maxlen specifies the maximum length to map. If you want to get access to
68 * the complete BAR from offset to the end, pass %0 here.
69 * */
70void __iomem *pci_iomap_wc_range(struct pci_dev *dev,
71 int bar,
72 unsigned long offset,
73 unsigned long maxlen)
74{
75 resource_size_t start = pci_resource_start(dev, bar);
76 resource_size_t len = pci_resource_len(dev, bar);
77 unsigned long flags = pci_resource_flags(dev, bar);
78
79
80 if (flags & IORESOURCE_IO)
81 return NULL;
82
83 if (len <= offset || !start)
84 return NULL;
85
86 len -= offset;
87 start += offset;
88 if (maxlen && len > maxlen)
89 len = maxlen;
90
91 if (flags & IORESOURCE_MEM)
92 return ioremap_wc(start, len);
93
94 /* What? */
95 return NULL;
96}
97EXPORT_SYMBOL_GPL(pci_iomap_wc_range);
98
99/**
55 * pci_iomap - create a virtual mapping cookie for a PCI BAR 100 * pci_iomap - create a virtual mapping cookie for a PCI BAR
56 * @dev: PCI device that owns the BAR 101 * @dev: PCI device that owns the BAR
57 * @bar: BAR number 102 * @bar: BAR number
@@ -70,4 +115,25 @@ void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
70 return pci_iomap_range(dev, bar, 0, maxlen); 115 return pci_iomap_range(dev, bar, 0, maxlen);
71} 116}
72EXPORT_SYMBOL(pci_iomap); 117EXPORT_SYMBOL(pci_iomap);
118
119/**
120 * pci_iomap_wc - create a virtual WC mapping cookie for a PCI BAR
121 * @dev: PCI device that owns the BAR
122 * @bar: BAR number
123 * @maxlen: length of the memory to map
124 *
125 * Using this function you will get a __iomem address to your device BAR.
126 * You can access it using ioread*() and iowrite*(). These functions hide
127 * the details if this is a MMIO or PIO address space and will just do what
128 * you expect from them in the correct way. When possible write combining
129 * is used.
130 *
131 * @maxlen specifies the maximum length to map. If you want to get access to
132 * the complete BAR without checking for its length first, pass %0 here.
133 * */
134void __iomem *pci_iomap_wc(struct pci_dev *dev, int bar, unsigned long maxlen)
135{
136 return pci_iomap_wc_range(dev, bar, 0, maxlen);
137}
138EXPORT_SYMBOL_GPL(pci_iomap_wc);
73#endif /* CONFIG_PCI */ 139#endif /* CONFIG_PCI */
diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index a60a6d335a91..cc0c69710dcf 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -610,6 +610,8 @@ next:
610 iter->skip = 0; 610 iter->skip = 0;
611 } 611 }
612 612
613 iter->p = NULL;
614
613 /* Ensure we see any new tables. */ 615 /* Ensure we see any new tables. */
614 smp_rmb(); 616 smp_rmb();
615 617
@@ -620,8 +622,6 @@ next:
620 return ERR_PTR(-EAGAIN); 622 return ERR_PTR(-EAGAIN);
621 } 623 }
622 624
623 iter->p = NULL;
624
625 return NULL; 625 return NULL;
626} 626}
627EXPORT_SYMBOL_GPL(rhashtable_walk_next); 627EXPORT_SYMBOL_GPL(rhashtable_walk_next);
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index da39c608a28c..95cd63b43b99 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -17,6 +17,7 @@
17 */ 17 */
18 18
19#include <stdarg.h> 19#include <stdarg.h>
20#include <linux/clk.h>
20#include <linux/clk-provider.h> 21#include <linux/clk-provider.h>
21#include <linux/module.h> /* for KSYM_SYMBOL_LEN */ 22#include <linux/module.h> /* for KSYM_SYMBOL_LEN */
22#include <linux/types.h> 23#include <linux/types.h>