Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.4 commit in: /
Date: Wed, 21 Nov 2018 15:02:41
Message-Id: 1542812502.1f6a366f0b664448104077ff329154ee34cde8c8.mpagano@gentoo
1 commit: 1f6a366f0b664448104077ff329154ee34cde8c8
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Oct 10 11:20:37 2018 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Nov 21 15:01:42 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=1f6a366f
7
8 Linux patch 4.4.160
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1159_linux-4.4.160.patch | 3244 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 3248 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 9f263b4..8c70f7e 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -679,6 +679,10 @@ Patch: 1158_linux-4.4.159.patch
21 From: http://www.kernel.org
22 Desc: Linux 4.4.159
23
24 +Patch: 1159_linux-4.4.160.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 4.4.160
27 +
28 Patch: 1500_XATTR_USER_PREFIX.patch
29 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
30 Desc: Support for namespace user.pax.* on tmpfs.
31
32 diff --git a/1159_linux-4.4.160.patch b/1159_linux-4.4.160.patch
33 new file mode 100644
34 index 0000000..88794cb
35 --- /dev/null
36 +++ b/1159_linux-4.4.160.patch
37 @@ -0,0 +1,3244 @@
38 +diff --git a/Documentation/hwmon/ina2xx b/Documentation/hwmon/ina2xx
39 +index cfd31d94c872..f8bf14055c2f 100644
40 +--- a/Documentation/hwmon/ina2xx
41 ++++ b/Documentation/hwmon/ina2xx
42 +@@ -32,7 +32,7 @@ Supported chips:
43 + Datasheet: Publicly available at the Texas Instruments website
44 + http://www.ti.com/
45 +
46 +-Author: Lothar Felten <l-felten@××.com>
47 ++Author: Lothar Felten <lothar.felten@×××××.com>
48 +
49 + Description
50 + -----------
51 +diff --git a/Makefile b/Makefile
52 +index 06d5c6a6a0f6..607394a56036 100644
53 +--- a/Makefile
54 ++++ b/Makefile
55 +@@ -1,6 +1,6 @@
56 + VERSION = 4
57 + PATCHLEVEL = 4
58 +-SUBLEVEL = 159
59 ++SUBLEVEL = 160
60 + EXTRAVERSION =
61 + NAME = Blurry Fish Butt
62 +
63 +diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
64 +index 02bd6312d1d9..e6a3a94bac69 100644
65 +--- a/arch/arm/boot/dts/dra7.dtsi
66 ++++ b/arch/arm/boot/dts/dra7.dtsi
67 +@@ -1549,7 +1549,7 @@
68 + };
69 + };
70 +
71 +- dcan1: can@481cc000 {
72 ++ dcan1: can@4ae3c000 {
73 + compatible = "ti,dra7-d_can";
74 + ti,hwmods = "dcan1";
75 + reg = <0x4ae3c000 0x2000>;
76 +@@ -1559,7 +1559,7 @@
77 + status = "disabled";
78 + };
79 +
80 +- dcan2: can@481d0000 {
81 ++ dcan2: can@48480000 {
82 + compatible = "ti,dra7-d_can";
83 + ti,hwmods = "dcan2";
84 + reg = <0x48480000 0x2000>;
85 +diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c
86 +index ed8fda4cd055..45fd4b173dac 100644
87 +--- a/arch/arm/mach-mvebu/pmsu.c
88 ++++ b/arch/arm/mach-mvebu/pmsu.c
89 +@@ -117,8 +117,8 @@ void mvebu_pmsu_set_cpu_boot_addr(int hw_cpu, void *boot_addr)
90 + PMSU_BOOT_ADDR_REDIRECT_OFFSET(hw_cpu));
91 + }
92 +
93 +-extern unsigned char mvebu_boot_wa_start;
94 +-extern unsigned char mvebu_boot_wa_end;
95 ++extern unsigned char mvebu_boot_wa_start[];
96 ++extern unsigned char mvebu_boot_wa_end[];
97 +
98 + /*
99 + * This function sets up the boot address workaround needed for SMP
100 +@@ -131,7 +131,7 @@ int mvebu_setup_boot_addr_wa(unsigned int crypto_eng_target,
101 + phys_addr_t resume_addr_reg)
102 + {
103 + void __iomem *sram_virt_base;
104 +- u32 code_len = &mvebu_boot_wa_end - &mvebu_boot_wa_start;
105 ++ u32 code_len = mvebu_boot_wa_end - mvebu_boot_wa_start;
106 +
107 + mvebu_mbus_del_window(BOOTROM_BASE, BOOTROM_SIZE);
108 + mvebu_mbus_add_window_by_id(crypto_eng_target, crypto_eng_attribute,
109 +diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h
110 +index 8884b5d5f48c..ad83c245781c 100644
111 +--- a/arch/arm64/include/asm/cpufeature.h
112 ++++ b/arch/arm64/include/asm/cpufeature.h
113 +@@ -31,8 +31,9 @@
114 + #define ARM64_WORKAROUND_CAVIUM_23154 6
115 + #define ARM64_WORKAROUND_834220 7
116 + #define ARM64_WORKAROUND_CAVIUM_27456 8
117 ++#define ARM64_HAS_32BIT_EL0 9
118 +
119 +-#define ARM64_NCAPS 9
120 ++#define ARM64_NCAPS 10
121 +
122 + #ifndef __ASSEMBLY__
123 +
124 +@@ -180,6 +181,11 @@ static inline bool cpu_supports_mixed_endian_el0(void)
125 + return id_aa64mmfr0_mixed_endian_el0(read_cpuid(ID_AA64MMFR0_EL1));
126 + }
127 +
128 ++static inline bool system_supports_32bit_el0(void)
129 ++{
130 ++ return cpus_have_cap(ARM64_HAS_32BIT_EL0);
131 ++}
132 ++
133 + static inline bool system_supports_mixed_endian_el0(void)
134 + {
135 + return id_aa64mmfr0_mixed_endian_el0(read_system_reg(SYS_ID_AA64MMFR0_EL1));
136 +diff --git a/arch/arm64/include/asm/jump_label.h b/arch/arm64/include/asm/jump_label.h
137 +index 1b5e0e843c3a..7e2b3e360086 100644
138 +--- a/arch/arm64/include/asm/jump_label.h
139 ++++ b/arch/arm64/include/asm/jump_label.h
140 +@@ -28,7 +28,7 @@
141 +
142 + static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
143 + {
144 +- asm goto("1: nop\n\t"
145 ++ asm_volatile_goto("1: nop\n\t"
146 + ".pushsection __jump_table, \"aw\"\n\t"
147 + ".align 3\n\t"
148 + ".quad 1b, %l[l_yes], %c0\n\t"
149 +@@ -42,7 +42,7 @@ l_yes:
150 +
151 + static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch)
152 + {
153 +- asm goto("1: b %l[l_yes]\n\t"
154 ++ asm_volatile_goto("1: b %l[l_yes]\n\t"
155 + ".pushsection __jump_table, \"aw\"\n\t"
156 + ".align 3\n\t"
157 + ".quad 1b, %l[l_yes], %c0\n\t"
158 +diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h
159 +index 25a40213bd9b..0729a2f94482 100644
160 +--- a/arch/arm64/include/asm/kvm_emulate.h
161 ++++ b/arch/arm64/include/asm/kvm_emulate.h
162 +@@ -41,6 +41,11 @@ void kvm_inject_undefined(struct kvm_vcpu *vcpu);
163 + void kvm_inject_dabt(struct kvm_vcpu *vcpu, unsigned long addr);
164 + void kvm_inject_pabt(struct kvm_vcpu *vcpu, unsigned long addr);
165 +
166 ++static inline bool vcpu_el1_is_32bit(struct kvm_vcpu *vcpu)
167 ++{
168 ++ return !(vcpu->arch.hcr_el2 & HCR_RW);
169 ++}
170 ++
171 + static inline void vcpu_reset_hcr(struct kvm_vcpu *vcpu)
172 + {
173 + vcpu->arch.hcr_el2 = HCR_GUEST_FLAGS;
174 +diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h
175 +index d48ab5b41f52..50150320f80d 100644
176 +--- a/arch/arm64/include/asm/sysreg.h
177 ++++ b/arch/arm64/include/asm/sysreg.h
178 +@@ -109,6 +109,7 @@
179 + #define ID_AA64PFR0_ASIMD_SUPPORTED 0x0
180 + #define ID_AA64PFR0_EL1_64BIT_ONLY 0x1
181 + #define ID_AA64PFR0_EL0_64BIT_ONLY 0x1
182 ++#define ID_AA64PFR0_EL0_32BIT_64BIT 0x2
183 +
184 + /* id_aa64mmfr0 */
185 + #define ID_AA64MMFR0_TGRAN4_SHIFT 28
186 +diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
187 +index 2735bf814592..c1eddc07d996 100644
188 +--- a/arch/arm64/kernel/cpufeature.c
189 ++++ b/arch/arm64/kernel/cpufeature.c
190 +@@ -653,6 +653,14 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
191 + .min_field_value = 2,
192 + },
193 + #endif /* CONFIG_AS_LSE && CONFIG_ARM64_LSE_ATOMICS */
194 ++ {
195 ++ .desc = "32-bit EL0 Support",
196 ++ .capability = ARM64_HAS_32BIT_EL0,
197 ++ .matches = has_cpuid_feature,
198 ++ .sys_reg = SYS_ID_AA64PFR0_EL1,
199 ++ .field_pos = ID_AA64PFR0_EL0_SHIFT,
200 ++ .min_field_value = ID_AA64PFR0_EL0_32BIT_64BIT,
201 ++ },
202 + {},
203 + };
204 +
205 +diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c
206 +index 3039f080e2d5..79705fde8cc8 100644
207 +--- a/arch/arm64/kvm/guest.c
208 ++++ b/arch/arm64/kvm/guest.c
209 +@@ -48,6 +48,45 @@ static u64 core_reg_offset_from_id(u64 id)
210 + return id & ~(KVM_REG_ARCH_MASK | KVM_REG_SIZE_MASK | KVM_REG_ARM_CORE);
211 + }
212 +
213 ++static int validate_core_offset(const struct kvm_one_reg *reg)
214 ++{
215 ++ u64 off = core_reg_offset_from_id(reg->id);
216 ++ int size;
217 ++
218 ++ switch (off) {
219 ++ case KVM_REG_ARM_CORE_REG(regs.regs[0]) ...
220 ++ KVM_REG_ARM_CORE_REG(regs.regs[30]):
221 ++ case KVM_REG_ARM_CORE_REG(regs.sp):
222 ++ case KVM_REG_ARM_CORE_REG(regs.pc):
223 ++ case KVM_REG_ARM_CORE_REG(regs.pstate):
224 ++ case KVM_REG_ARM_CORE_REG(sp_el1):
225 ++ case KVM_REG_ARM_CORE_REG(elr_el1):
226 ++ case KVM_REG_ARM_CORE_REG(spsr[0]) ...
227 ++ KVM_REG_ARM_CORE_REG(spsr[KVM_NR_SPSR - 1]):
228 ++ size = sizeof(__u64);
229 ++ break;
230 ++
231 ++ case KVM_REG_ARM_CORE_REG(fp_regs.vregs[0]) ...
232 ++ KVM_REG_ARM_CORE_REG(fp_regs.vregs[31]):
233 ++ size = sizeof(__uint128_t);
234 ++ break;
235 ++
236 ++ case KVM_REG_ARM_CORE_REG(fp_regs.fpsr):
237 ++ case KVM_REG_ARM_CORE_REG(fp_regs.fpcr):
238 ++ size = sizeof(__u32);
239 ++ break;
240 ++
241 ++ default:
242 ++ return -EINVAL;
243 ++ }
244 ++
245 ++ if (KVM_REG_SIZE(reg->id) == size &&
246 ++ IS_ALIGNED(off, size / sizeof(__u32)))
247 ++ return 0;
248 ++
249 ++ return -EINVAL;
250 ++}
251 ++
252 + static int get_core_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
253 + {
254 + /*
255 +@@ -67,6 +106,9 @@ static int get_core_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
256 + (off + (KVM_REG_SIZE(reg->id) / sizeof(__u32))) >= nr_regs)
257 + return -ENOENT;
258 +
259 ++ if (validate_core_offset(reg))
260 ++ return -EINVAL;
261 ++
262 + if (copy_to_user(uaddr, ((u32 *)regs) + off, KVM_REG_SIZE(reg->id)))
263 + return -EFAULT;
264 +
265 +@@ -89,6 +131,9 @@ static int set_core_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
266 + (off + (KVM_REG_SIZE(reg->id) / sizeof(__u32))) >= nr_regs)
267 + return -ENOENT;
268 +
269 ++ if (validate_core_offset(reg))
270 ++ return -EINVAL;
271 ++
272 + if (KVM_REG_SIZE(reg->id) > sizeof(tmp))
273 + return -EINVAL;
274 +
275 +@@ -98,17 +143,25 @@ static int set_core_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
276 + }
277 +
278 + if (off == KVM_REG_ARM_CORE_REG(regs.pstate)) {
279 +- u32 mode = (*(u32 *)valp) & COMPAT_PSR_MODE_MASK;
280 ++ u64 mode = (*(u64 *)valp) & COMPAT_PSR_MODE_MASK;
281 + switch (mode) {
282 + case COMPAT_PSR_MODE_USR:
283 ++ if (!system_supports_32bit_el0())
284 ++ return -EINVAL;
285 ++ break;
286 + case COMPAT_PSR_MODE_FIQ:
287 + case COMPAT_PSR_MODE_IRQ:
288 + case COMPAT_PSR_MODE_SVC:
289 + case COMPAT_PSR_MODE_ABT:
290 + case COMPAT_PSR_MODE_UND:
291 ++ if (!vcpu_el1_is_32bit(vcpu))
292 ++ return -EINVAL;
293 ++ break;
294 + case PSR_MODE_EL0t:
295 + case PSR_MODE_EL1t:
296 + case PSR_MODE_EL1h:
297 ++ if (vcpu_el1_is_32bit(vcpu))
298 ++ return -EINVAL;
299 + break;
300 + default:
301 + err = -EINVAL;
302 +diff --git a/arch/hexagon/include/asm/bitops.h b/arch/hexagon/include/asm/bitops.h
303 +index 5e4a59b3ec1b..2691a1857d20 100644
304 +--- a/arch/hexagon/include/asm/bitops.h
305 ++++ b/arch/hexagon/include/asm/bitops.h
306 +@@ -211,7 +211,7 @@ static inline long ffz(int x)
307 + * This is defined the same way as ffs.
308 + * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
309 + */
310 +-static inline long fls(int x)
311 ++static inline int fls(int x)
312 + {
313 + int r;
314 +
315 +@@ -232,7 +232,7 @@ static inline long fls(int x)
316 + * the libc and compiler builtin ffs routines, therefore
317 + * differs in spirit from the above ffz (man ffs).
318 + */
319 +-static inline long ffs(int x)
320 ++static inline int ffs(int x)
321 + {
322 + int r;
323 +
324 +diff --git a/arch/hexagon/kernel/dma.c b/arch/hexagon/kernel/dma.c
325 +index 9e3ddf792bd3..2704e0b8de43 100644
326 +--- a/arch/hexagon/kernel/dma.c
327 ++++ b/arch/hexagon/kernel/dma.c
328 +@@ -68,7 +68,7 @@ static void *hexagon_dma_alloc_coherent(struct device *dev, size_t size,
329 + panic("Can't create %s() memory pool!", __func__);
330 + else
331 + gen_pool_add(coherent_pool,
332 +- pfn_to_virt(max_low_pfn),
333 ++ (unsigned long)pfn_to_virt(max_low_pfn),
334 + hexagon_coherent_pool_size, -1);
335 + }
336 +
337 +diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
338 +index 015ae55c1868..8dff2b371219 100644
339 +--- a/arch/powerpc/kernel/machine_kexec.c
340 ++++ b/arch/powerpc/kernel/machine_kexec.c
341 +@@ -186,7 +186,12 @@ void __init reserve_crashkernel(void)
342 + (unsigned long)(crashk_res.start >> 20),
343 + (unsigned long)(memblock_phys_mem_size() >> 20));
344 +
345 +- memblock_reserve(crashk_res.start, crash_size);
346 ++ if (!memblock_is_region_memory(crashk_res.start, crash_size) ||
347 ++ memblock_reserve(crashk_res.start, crash_size)) {
348 ++ pr_err("Failed to reserve memory for crashkernel!\n");
349 ++ crashk_res.start = crashk_res.end = 0;
350 ++ return;
351 ++ }
352 + }
353 +
354 + int overlaps_crashkernel(unsigned long start, unsigned long size)
355 +diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c
356 +index fb37290a57b4..366965ae37bd 100644
357 +--- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
358 ++++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
359 +@@ -314,7 +314,7 @@ static int kvmppc_mmu_book3s_64_hv_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
360 + unsigned long pp, key;
361 + unsigned long v, gr;
362 + __be64 *hptep;
363 +- int index;
364 ++ long int index;
365 + int virtmode = vcpu->arch.shregs.msr & (data ? MSR_DR : MSR_IR);
366 +
367 + /* Get SLB entry */
368 +diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
369 +index eac3b7cc78c6..ab7b2594e0f6 100644
370 +--- a/arch/powerpc/platforms/powernv/pci-ioda.c
371 ++++ b/arch/powerpc/platforms/powernv/pci-ioda.c
372 +@@ -2270,7 +2270,7 @@ static long pnv_pci_ioda2_table_alloc_pages(int nid, __u64 bus_offset,
373 + level_shift = entries_shift + 3;
374 + level_shift = max_t(unsigned, level_shift, PAGE_SHIFT);
375 +
376 +- if ((level_shift - 3) * levels + page_shift >= 60)
377 ++ if ((level_shift - 3) * levels + page_shift >= 55)
378 + return -EINVAL;
379 +
380 + /* Allocate TCE table */
381 +diff --git a/arch/s390/mm/extmem.c b/arch/s390/mm/extmem.c
382 +index 18fccc303db7..bfd75be6d415 100644
383 +--- a/arch/s390/mm/extmem.c
384 ++++ b/arch/s390/mm/extmem.c
385 +@@ -79,7 +79,7 @@ struct qin64 {
386 + struct dcss_segment {
387 + struct list_head list;
388 + char dcss_name[8];
389 +- char res_name[15];
390 ++ char res_name[16];
391 + unsigned long start_addr;
392 + unsigned long end;
393 + atomic_t ref_count;
394 +@@ -434,7 +434,7 @@ __segment_load (char *name, int do_nonshared, unsigned long *addr, unsigned long
395 + memcpy(&seg->res_name, seg->dcss_name, 8);
396 + EBCASC(seg->res_name, 8);
397 + seg->res_name[8] = '\0';
398 +- strncat(seg->res_name, " (DCSS)", 7);
399 ++ strlcat(seg->res_name, " (DCSS)", sizeof(seg->res_name));
400 + seg->res->name = seg->res_name;
401 + rc = seg->vm_segtype;
402 + if (rc == SEG_TYPE_SC ||
403 +diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
404 +index 92b840c94f17..8be48b1d7596 100644
405 +--- a/arch/x86/entry/entry_64.S
406 ++++ b/arch/x86/entry/entry_64.S
407 +@@ -90,7 +90,7 @@ ENDPROC(native_usergs_sysret64)
408 + .endm
409 +
410 + .macro TRACE_IRQS_IRETQ_DEBUG
411 +- bt $9, EFLAGS(%rsp) /* interrupts off? */
412 ++ btl $9, EFLAGS(%rsp) /* interrupts off? */
413 + jnc 1f
414 + TRACE_IRQS_ON_DEBUG
415 + 1:
416 +@@ -620,7 +620,7 @@ retint_kernel:
417 + #ifdef CONFIG_PREEMPT
418 + /* Interrupts are off */
419 + /* Check if we need preemption */
420 +- bt $9, EFLAGS(%rsp) /* were interrupts off? */
421 ++ btl $9, EFLAGS(%rsp) /* were interrupts off? */
422 + jnc 1f
423 + 0: cmpl $0, PER_CPU_VAR(__preempt_count)
424 + jnz 1f
425 +diff --git a/arch/x86/kernel/tsc_msr.c b/arch/x86/kernel/tsc_msr.c
426 +index 6aa0f4d9eea6..0e37e369b3a0 100644
427 +--- a/arch/x86/kernel/tsc_msr.c
428 ++++ b/arch/x86/kernel/tsc_msr.c
429 +@@ -21,6 +21,7 @@
430 + #include <asm/setup.h>
431 + #include <asm/apic.h>
432 + #include <asm/param.h>
433 ++#include <asm/tsc.h>
434 +
435 + /* CPU reference clock frequency: in KHz */
436 + #define FREQ_83 83200
437 +diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c
438 +index a8f90ce3dedf..dc6d99017f3f 100644
439 +--- a/arch/x86/mm/numa_emulation.c
440 ++++ b/arch/x86/mm/numa_emulation.c
441 +@@ -60,7 +60,7 @@ static int __init emu_setup_memblk(struct numa_meminfo *ei,
442 + eb->nid = nid;
443 +
444 + if (emu_nid_to_phys[nid] == NUMA_NO_NODE)
445 +- emu_nid_to_phys[nid] = nid;
446 ++ emu_nid_to_phys[nid] = pb->nid;
447 +
448 + pb->start += size;
449 + if (pb->start >= pb->end) {
450 +diff --git a/crypto/ablkcipher.c b/crypto/ablkcipher.c
451 +index 149e7a7f04fe..b524f702e658 100644
452 +--- a/crypto/ablkcipher.c
453 ++++ b/crypto/ablkcipher.c
454 +@@ -384,6 +384,7 @@ static int crypto_ablkcipher_report(struct sk_buff *skb, struct crypto_alg *alg)
455 + strncpy(rblkcipher.type, "ablkcipher", sizeof(rblkcipher.type));
456 + strncpy(rblkcipher.geniv, alg->cra_ablkcipher.geniv ?: "<default>",
457 + sizeof(rblkcipher.geniv));
458 ++ rblkcipher.geniv[sizeof(rblkcipher.geniv) - 1] = '\0';
459 +
460 + rblkcipher.blocksize = alg->cra_blocksize;
461 + rblkcipher.min_keysize = alg->cra_ablkcipher.min_keysize;
462 +@@ -465,6 +466,7 @@ static int crypto_givcipher_report(struct sk_buff *skb, struct crypto_alg *alg)
463 + strncpy(rblkcipher.type, "givcipher", sizeof(rblkcipher.type));
464 + strncpy(rblkcipher.geniv, alg->cra_ablkcipher.geniv ?: "<built-in>",
465 + sizeof(rblkcipher.geniv));
466 ++ rblkcipher.geniv[sizeof(rblkcipher.geniv) - 1] = '\0';
467 +
468 + rblkcipher.blocksize = alg->cra_blocksize;
469 + rblkcipher.min_keysize = alg->cra_ablkcipher.min_keysize;
470 +diff --git a/crypto/blkcipher.c b/crypto/blkcipher.c
471 +index 2d08e59b3212..d524f838eb10 100644
472 +--- a/crypto/blkcipher.c
473 ++++ b/crypto/blkcipher.c
474 +@@ -515,6 +515,7 @@ static int crypto_blkcipher_report(struct sk_buff *skb, struct crypto_alg *alg)
475 + strncpy(rblkcipher.type, "blkcipher", sizeof(rblkcipher.type));
476 + strncpy(rblkcipher.geniv, alg->cra_blkcipher.geniv ?: "<default>",
477 + sizeof(rblkcipher.geniv));
478 ++ rblkcipher.geniv[sizeof(rblkcipher.geniv) - 1] = '\0';
479 +
480 + rblkcipher.blocksize = alg->cra_blocksize;
481 + rblkcipher.min_keysize = alg->cra_blkcipher.min_keysize;
482 +diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
483 +index 331363e7de0f..2daa5b84abbc 100644
484 +--- a/drivers/block/floppy.c
485 ++++ b/drivers/block/floppy.c
486 +@@ -3459,6 +3459,9 @@ static int fd_locked_ioctl(struct block_device *bdev, fmode_t mode, unsigned int
487 + (struct floppy_struct **)&outparam);
488 + if (ret)
489 + return ret;
490 ++ memcpy(&inparam.g, outparam,
491 ++ offsetof(struct floppy_struct, name));
492 ++ outparam = &inparam.g;
493 + break;
494 + case FDMSGON:
495 + UDP->flags |= FTD_MSG;
496 +diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
497 +index 4a899b41145e..b0a12e6dae43 100644
498 +--- a/drivers/bluetooth/btusb.c
499 ++++ b/drivers/bluetooth/btusb.c
500 +@@ -340,6 +340,7 @@ static const struct usb_device_id blacklist_table[] = {
501 + { USB_DEVICE(0x7392, 0xa611), .driver_info = BTUSB_REALTEK },
502 +
503 + /* Additional Realtek 8723DE Bluetooth devices */
504 ++ { USB_DEVICE(0x0bda, 0xb009), .driver_info = BTUSB_REALTEK },
505 + { USB_DEVICE(0x2ff8, 0xb011), .driver_info = BTUSB_REALTEK },
506 +
507 + /* Additional Realtek 8821AE Bluetooth devices */
508 +diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c
509 +index 59ed54e464a9..fe8cfe24c518 100644
510 +--- a/drivers/crypto/mxs-dcp.c
511 ++++ b/drivers/crypto/mxs-dcp.c
512 +@@ -63,7 +63,7 @@ struct dcp {
513 + struct dcp_coherent_block *coh;
514 +
515 + struct completion completion[DCP_MAX_CHANS];
516 +- struct mutex mutex[DCP_MAX_CHANS];
517 ++ spinlock_t lock[DCP_MAX_CHANS];
518 + struct task_struct *thread[DCP_MAX_CHANS];
519 + struct crypto_queue queue[DCP_MAX_CHANS];
520 + };
521 +@@ -349,13 +349,20 @@ static int dcp_chan_thread_aes(void *data)
522 +
523 + int ret;
524 +
525 +- do {
526 +- __set_current_state(TASK_INTERRUPTIBLE);
527 ++ while (!kthread_should_stop()) {
528 ++ set_current_state(TASK_INTERRUPTIBLE);
529 +
530 +- mutex_lock(&sdcp->mutex[chan]);
531 ++ spin_lock(&sdcp->lock[chan]);
532 + backlog = crypto_get_backlog(&sdcp->queue[chan]);
533 + arq = crypto_dequeue_request(&sdcp->queue[chan]);
534 +- mutex_unlock(&sdcp->mutex[chan]);
535 ++ spin_unlock(&sdcp->lock[chan]);
536 ++
537 ++ if (!backlog && !arq) {
538 ++ schedule();
539 ++ continue;
540 ++ }
541 ++
542 ++ set_current_state(TASK_RUNNING);
543 +
544 + if (backlog)
545 + backlog->complete(backlog, -EINPROGRESS);
546 +@@ -363,11 +370,8 @@ static int dcp_chan_thread_aes(void *data)
547 + if (arq) {
548 + ret = mxs_dcp_aes_block_crypt(arq);
549 + arq->complete(arq, ret);
550 +- continue;
551 + }
552 +-
553 +- schedule();
554 +- } while (!kthread_should_stop());
555 ++ }
556 +
557 + return 0;
558 + }
559 +@@ -407,9 +411,9 @@ static int mxs_dcp_aes_enqueue(struct ablkcipher_request *req, int enc, int ecb)
560 + rctx->ecb = ecb;
561 + actx->chan = DCP_CHAN_CRYPTO;
562 +
563 +- mutex_lock(&sdcp->mutex[actx->chan]);
564 ++ spin_lock(&sdcp->lock[actx->chan]);
565 + ret = crypto_enqueue_request(&sdcp->queue[actx->chan], &req->base);
566 +- mutex_unlock(&sdcp->mutex[actx->chan]);
567 ++ spin_unlock(&sdcp->lock[actx->chan]);
568 +
569 + wake_up_process(sdcp->thread[actx->chan]);
570 +
571 +@@ -645,13 +649,20 @@ static int dcp_chan_thread_sha(void *data)
572 + struct ahash_request *req;
573 + int ret, fini;
574 +
575 +- do {
576 +- __set_current_state(TASK_INTERRUPTIBLE);
577 ++ while (!kthread_should_stop()) {
578 ++ set_current_state(TASK_INTERRUPTIBLE);
579 +
580 +- mutex_lock(&sdcp->mutex[chan]);
581 ++ spin_lock(&sdcp->lock[chan]);
582 + backlog = crypto_get_backlog(&sdcp->queue[chan]);
583 + arq = crypto_dequeue_request(&sdcp->queue[chan]);
584 +- mutex_unlock(&sdcp->mutex[chan]);
585 ++ spin_unlock(&sdcp->lock[chan]);
586 ++
587 ++ if (!backlog && !arq) {
588 ++ schedule();
589 ++ continue;
590 ++ }
591 ++
592 ++ set_current_state(TASK_RUNNING);
593 +
594 + if (backlog)
595 + backlog->complete(backlog, -EINPROGRESS);
596 +@@ -663,12 +674,8 @@ static int dcp_chan_thread_sha(void *data)
597 + ret = dcp_sha_req_to_buf(arq);
598 + fini = rctx->fini;
599 + arq->complete(arq, ret);
600 +- if (!fini)
601 +- continue;
602 + }
603 +-
604 +- schedule();
605 +- } while (!kthread_should_stop());
606 ++ }
607 +
608 + return 0;
609 + }
610 +@@ -726,9 +733,9 @@ static int dcp_sha_update_fx(struct ahash_request *req, int fini)
611 + rctx->init = 1;
612 + }
613 +
614 +- mutex_lock(&sdcp->mutex[actx->chan]);
615 ++ spin_lock(&sdcp->lock[actx->chan]);
616 + ret = crypto_enqueue_request(&sdcp->queue[actx->chan], &req->base);
617 +- mutex_unlock(&sdcp->mutex[actx->chan]);
618 ++ spin_unlock(&sdcp->lock[actx->chan]);
619 +
620 + wake_up_process(sdcp->thread[actx->chan]);
621 + mutex_unlock(&actx->mutex);
622 +@@ -984,7 +991,7 @@ static int mxs_dcp_probe(struct platform_device *pdev)
623 + platform_set_drvdata(pdev, sdcp);
624 +
625 + for (i = 0; i < DCP_MAX_CHANS; i++) {
626 +- mutex_init(&sdcp->mutex[i]);
627 ++ spin_lock_init(&sdcp->lock[i]);
628 + init_completion(&sdcp->completion[i]);
629 + crypto_init_queue(&sdcp->queue[i], 50);
630 + }
631 +diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c
632 +index 792bdae2b91d..d14c8ffea910 100644
633 +--- a/drivers/edac/i7core_edac.c
634 ++++ b/drivers/edac/i7core_edac.c
635 +@@ -1187,15 +1187,14 @@ static int i7core_create_sysfs_devices(struct mem_ctl_info *mci)
636 +
637 + rc = device_add(pvt->addrmatch_dev);
638 + if (rc < 0)
639 +- return rc;
640 ++ goto err_put_addrmatch;
641 +
642 + if (!pvt->is_registered) {
643 + pvt->chancounts_dev = kzalloc(sizeof(*pvt->chancounts_dev),
644 + GFP_KERNEL);
645 + if (!pvt->chancounts_dev) {
646 +- put_device(pvt->addrmatch_dev);
647 +- device_del(pvt->addrmatch_dev);
648 +- return -ENOMEM;
649 ++ rc = -ENOMEM;
650 ++ goto err_del_addrmatch;
651 + }
652 +
653 + pvt->chancounts_dev->type = &all_channel_counts_type;
654 +@@ -1209,9 +1208,18 @@ static int i7core_create_sysfs_devices(struct mem_ctl_info *mci)
655 +
656 + rc = device_add(pvt->chancounts_dev);
657 + if (rc < 0)
658 +- return rc;
659 ++ goto err_put_chancounts;
660 + }
661 + return 0;
662 ++
663 ++err_put_chancounts:
664 ++ put_device(pvt->chancounts_dev);
665 ++err_del_addrmatch:
666 ++ device_del(pvt->addrmatch_dev);
667 ++err_put_addrmatch:
668 ++ put_device(pvt->addrmatch_dev);
669 ++
670 ++ return rc;
671 + }
672 +
673 + static void i7core_delete_sysfs_devices(struct mem_ctl_info *mci)
674 +@@ -1221,11 +1229,11 @@ static void i7core_delete_sysfs_devices(struct mem_ctl_info *mci)
675 + edac_dbg(1, "\n");
676 +
677 + if (!pvt->is_registered) {
678 +- put_device(pvt->chancounts_dev);
679 + device_del(pvt->chancounts_dev);
680 ++ put_device(pvt->chancounts_dev);
681 + }
682 +- put_device(pvt->addrmatch_dev);
683 + device_del(pvt->addrmatch_dev);
684 ++ put_device(pvt->addrmatch_dev);
685 + }
686 +
687 + /****************************************************************************
688 +diff --git a/drivers/gpio/gpio-adp5588.c b/drivers/gpio/gpio-adp5588.c
689 +index 984186ee58a0..f5f7b5368da6 100644
690 +--- a/drivers/gpio/gpio-adp5588.c
691 ++++ b/drivers/gpio/gpio-adp5588.c
692 +@@ -41,6 +41,8 @@ struct adp5588_gpio {
693 + uint8_t int_en[3];
694 + uint8_t irq_mask[3];
695 + uint8_t irq_stat[3];
696 ++ uint8_t int_input_en[3];
697 ++ uint8_t int_lvl_cached[3];
698 + };
699 +
700 + static int adp5588_gpio_read(struct i2c_client *client, u8 reg)
701 +@@ -177,12 +179,28 @@ static void adp5588_irq_bus_sync_unlock(struct irq_data *d)
702 + struct adp5588_gpio *dev = irq_data_get_irq_chip_data(d);
703 + int i;
704 +
705 +- for (i = 0; i <= ADP5588_BANK(ADP5588_MAXGPIO); i++)
706 ++ for (i = 0; i <= ADP5588_BANK(ADP5588_MAXGPIO); i++) {
707 ++ if (dev->int_input_en[i]) {
708 ++ mutex_lock(&dev->lock);
709 ++ dev->dir[i] &= ~dev->int_input_en[i];
710 ++ dev->int_input_en[i] = 0;
711 ++ adp5588_gpio_write(dev->client, GPIO_DIR1 + i,
712 ++ dev->dir[i]);
713 ++ mutex_unlock(&dev->lock);
714 ++ }
715 ++
716 ++ if (dev->int_lvl_cached[i] != dev->int_lvl[i]) {
717 ++ dev->int_lvl_cached[i] = dev->int_lvl[i];
718 ++ adp5588_gpio_write(dev->client, GPIO_INT_LVL1 + i,
719 ++ dev->int_lvl[i]);
720 ++ }
721 ++
722 + if (dev->int_en[i] ^ dev->irq_mask[i]) {
723 + dev->int_en[i] = dev->irq_mask[i];
724 + adp5588_gpio_write(dev->client, GPIO_INT_EN1 + i,
725 + dev->int_en[i]);
726 + }
727 ++ }
728 +
729 + mutex_unlock(&dev->irq_lock);
730 + }
731 +@@ -225,9 +243,7 @@ static int adp5588_irq_set_type(struct irq_data *d, unsigned int type)
732 + else
733 + return -EINVAL;
734 +
735 +- adp5588_gpio_direction_input(&dev->gpio_chip, gpio);
736 +- adp5588_gpio_write(dev->client, GPIO_INT_LVL1 + bank,
737 +- dev->int_lvl[bank]);
738 ++ dev->int_input_en[bank] |= bit;
739 +
740 + return 0;
741 + }
742 +diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm204.c b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm204.c
743 +index 2b9c3f11b7a8..ba42ed86148a 100644
744 +--- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm204.c
745 ++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm204.c
746 +@@ -161,7 +161,8 @@ gm204_devinit_post(struct nvkm_devinit *base, bool post)
747 + }
748 +
749 + /* load and execute some other ucode image (bios therm?) */
750 +- return pmu_load(init, 0x01, post, NULL, NULL);
751 ++ pmu_load(init, 0x01, post, NULL, NULL);
752 ++ return 0;
753 + }
754 +
755 + static const struct nvkm_devinit_func
756 +diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c
757 +index 756d1ef9bd99..6124fd6e04d1 100644
758 +--- a/drivers/hid/hid-ntrig.c
759 ++++ b/drivers/hid/hid-ntrig.c
760 +@@ -955,6 +955,8 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
761 +
762 + ret = sysfs_create_group(&hdev->dev.kobj,
763 + &ntrig_attribute_group);
764 ++ if (ret)
765 ++ hid_err(hdev, "cannot create sysfs group\n");
766 +
767 + return 0;
768 + err_free:
769 +diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c
770 +index 3cefd1aeb24f..9c262d955331 100644
771 +--- a/drivers/hwmon/adt7475.c
772 ++++ b/drivers/hwmon/adt7475.c
773 +@@ -274,14 +274,18 @@ static inline u16 volt2reg(int channel, long volt, u8 bypass_attn)
774 + return clamp_val(reg, 0, 1023) & (0xff << 2);
775 + }
776 +
777 +-static u16 adt7475_read_word(struct i2c_client *client, int reg)
778 ++static int adt7475_read_word(struct i2c_client *client, int reg)
779 + {
780 +- u16 val;
781 ++ int val1, val2;
782 +
783 +- val = i2c_smbus_read_byte_data(client, reg);
784 +- val |= (i2c_smbus_read_byte_data(client, reg + 1) << 8);
785 ++ val1 = i2c_smbus_read_byte_data(client, reg);
786 ++ if (val1 < 0)
787 ++ return val1;
788 ++ val2 = i2c_smbus_read_byte_data(client, reg + 1);
789 ++ if (val2 < 0)
790 ++ return val2;
791 +
792 +- return val;
793 ++ return val1 | (val2 << 8);
794 + }
795 +
796 + static void adt7475_write_word(struct i2c_client *client, int reg, u16 val)
797 +diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c
798 +index ac63e562071f..9ac6e1673375 100644
799 +--- a/drivers/hwmon/ina2xx.c
800 ++++ b/drivers/hwmon/ina2xx.c
801 +@@ -17,7 +17,7 @@
802 + * Bi-directional Current/Power Monitor with I2C Interface
803 + * Datasheet: http://www.ti.com/product/ina230
804 + *
805 +- * Copyright (C) 2012 Lothar Felten <l-felten@××.com>
806 ++ * Copyright (C) 2012 Lothar Felten <lothar.felten@×××××.com>
807 + * Thanks to Jan Volkering
808 + *
809 + * This program is free software; you can redistribute it and/or modify
810 +@@ -328,6 +328,15 @@ static int ina2xx_set_shunt(struct ina2xx_data *data, long val)
811 + return 0;
812 + }
813 +
814 ++static ssize_t ina2xx_show_shunt(struct device *dev,
815 ++ struct device_attribute *da,
816 ++ char *buf)
817 ++{
818 ++ struct ina2xx_data *data = dev_get_drvdata(dev);
819 ++
820 ++ return snprintf(buf, PAGE_SIZE, "%li\n", data->rshunt);
821 ++}
822 ++
823 + static ssize_t ina2xx_store_shunt(struct device *dev,
824 + struct device_attribute *da,
825 + const char *buf, size_t count)
826 +@@ -402,7 +411,7 @@ static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, ina2xx_show_value, NULL,
827 +
828 + /* shunt resistance */
829 + static SENSOR_DEVICE_ATTR(shunt_resistor, S_IRUGO | S_IWUSR,
830 +- ina2xx_show_value, ina2xx_store_shunt,
831 ++ ina2xx_show_shunt, ina2xx_store_shunt,
832 + INA2XX_CALIBRATION);
833 +
834 + /* update interval (ina226 only) */
835 +diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
836 +index 47581c32b1e1..f78069cd8d53 100644
837 +--- a/drivers/i2c/busses/i2c-i801.c
838 ++++ b/drivers/i2c/busses/i2c-i801.c
839 +@@ -1272,6 +1272,13 @@ static void i801_add_tco(struct i801_priv *priv)
840 + }
841 +
842 + #ifdef CONFIG_ACPI
843 ++static bool i801_acpi_is_smbus_ioport(const struct i801_priv *priv,
844 ++ acpi_physical_address address)
845 ++{
846 ++ return address >= priv->smba &&
847 ++ address <= pci_resource_end(priv->pci_dev, SMBBAR);
848 ++}
849 ++
850 + static acpi_status
851 + i801_acpi_io_handler(u32 function, acpi_physical_address address, u32 bits,
852 + u64 *value, void *handler_context, void *region_context)
853 +@@ -1287,7 +1294,7 @@ i801_acpi_io_handler(u32 function, acpi_physical_address address, u32 bits,
854 + */
855 + mutex_lock(&priv->acpi_lock);
856 +
857 +- if (!priv->acpi_reserved) {
858 ++ if (!priv->acpi_reserved && i801_acpi_is_smbus_ioport(priv, address)) {
859 + priv->acpi_reserved = true;
860 +
861 + dev_warn(&pdev->dev, "BIOS is accessing SMBus registers\n");
862 +diff --git a/drivers/i2c/busses/i2c-uniphier-f.c b/drivers/i2c/busses/i2c-uniphier-f.c
863 +index e8d03bcfe3e0..3f6b43fe4d5d 100644
864 +--- a/drivers/i2c/busses/i2c-uniphier-f.c
865 ++++ b/drivers/i2c/busses/i2c-uniphier-f.c
866 +@@ -394,11 +394,8 @@ static int uniphier_fi2c_master_xfer(struct i2c_adapter *adap,
867 + return ret;
868 +
869 + for (msg = msgs; msg < emsg; msg++) {
870 +- /* If next message is read, skip the stop condition */
871 +- bool stop = !(msg + 1 < emsg && msg[1].flags & I2C_M_RD);
872 +- /* but, force it if I2C_M_STOP is set */
873 +- if (msg->flags & I2C_M_STOP)
874 +- stop = true;
875 ++ /* Emit STOP if it is the last message or I2C_M_STOP is set. */
876 ++ bool stop = (msg + 1 == emsg) || (msg->flags & I2C_M_STOP);
877 +
878 + ret = uniphier_fi2c_master_xfer_one(adap, msg, stop);
879 + if (ret)
880 +diff --git a/drivers/i2c/busses/i2c-uniphier.c b/drivers/i2c/busses/i2c-uniphier.c
881 +index e3c3861c3325..ad5eb8bacc6d 100644
882 +--- a/drivers/i2c/busses/i2c-uniphier.c
883 ++++ b/drivers/i2c/busses/i2c-uniphier.c
884 +@@ -247,11 +247,8 @@ static int uniphier_i2c_master_xfer(struct i2c_adapter *adap,
885 + return ret;
886 +
887 + for (msg = msgs; msg < emsg; msg++) {
888 +- /* If next message is read, skip the stop condition */
889 +- bool stop = !(msg + 1 < emsg && msg[1].flags & I2C_M_RD);
890 +- /* but, force it if I2C_M_STOP is set */
891 +- if (msg->flags & I2C_M_STOP)
892 +- stop = true;
893 ++ /* Emit STOP if it is the last message or I2C_M_STOP is set. */
894 ++ bool stop = (msg + 1 == emsg) || (msg->flags & I2C_M_STOP);
895 +
896 + ret = uniphier_i2c_master_xfer_one(adap, msg, stop);
897 + if (ret)
898 +diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c
899 +index 55aa8d3d752f..9712a63957e1 100644
900 +--- a/drivers/infiniband/core/ucma.c
901 ++++ b/drivers/infiniband/core/ucma.c
902 +@@ -123,6 +123,8 @@ static DEFINE_MUTEX(mut);
903 + static DEFINE_IDR(ctx_idr);
904 + static DEFINE_IDR(multicast_idr);
905 +
906 ++static const struct file_operations ucma_fops;
907 ++
908 + static inline struct ucma_context *_ucma_find_context(int id,
909 + struct ucma_file *file)
910 + {
911 +@@ -1535,6 +1537,10 @@ static ssize_t ucma_migrate_id(struct ucma_file *new_file,
912 + f = fdget(cmd.fd);
913 + if (!f.file)
914 + return -ENOENT;
915 ++ if (f.file->f_op != &ucma_fops) {
916 ++ ret = -EINVAL;
917 ++ goto file_put;
918 ++ }
919 +
920 + /* Validate current fd and prevent destruction of id. */
921 + ctx = ucma_get_ctx(f.file->private_data, cmd.id);
922 +diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
923 +index 4fd2892613dd..1897c4080346 100644
924 +--- a/drivers/infiniband/ulp/srp/ib_srp.c
925 ++++ b/drivers/infiniband/ulp/srp/ib_srp.c
926 +@@ -2594,7 +2594,7 @@ static int srp_reset_device(struct scsi_cmnd *scmnd)
927 + {
928 + struct srp_target_port *target = host_to_target(scmnd->device->host);
929 + struct srp_rdma_ch *ch;
930 +- int i;
931 ++ int i, j;
932 + u8 status;
933 +
934 + shost_printk(KERN_ERR, target->scsi_host, "SRP reset_device called\n");
935 +@@ -2608,8 +2608,8 @@ static int srp_reset_device(struct scsi_cmnd *scmnd)
936 +
937 + for (i = 0; i < target->ch_count; i++) {
938 + ch = &target->ch[i];
939 +- for (i = 0; i < target->req_ring_size; ++i) {
940 +- struct srp_request *req = &ch->req_ring[i];
941 ++ for (j = 0; j < target->req_ring_size; ++j) {
942 ++ struct srp_request *req = &ch->req_ring[j];
943 +
944 + srp_finish_req(ch, req, scmnd->device, DID_RESET << 16);
945 + }
946 +diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
947 +index 174bb52c578b..84aead19622c 100644
948 +--- a/drivers/input/mouse/elantech.c
949 ++++ b/drivers/input/mouse/elantech.c
950 +@@ -1180,6 +1180,8 @@ static const struct dmi_system_id elantech_dmi_has_middle_button[] = {
951 + static const char * const middle_button_pnp_ids[] = {
952 + "LEN2131", /* ThinkPad P52 w/ NFC */
953 + "LEN2132", /* ThinkPad P52 */
954 ++ "LEN2133", /* ThinkPad P72 w/ NFC */
955 ++ "LEN2134", /* ThinkPad P72 */
956 + NULL
957 + };
958 +
959 +diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c
960 +index e339f4288e8f..2711aa965445 100644
961 +--- a/drivers/md/dm-thin-metadata.c
962 ++++ b/drivers/md/dm-thin-metadata.c
963 +@@ -189,6 +189,12 @@ struct dm_pool_metadata {
964 + unsigned long flags;
965 + sector_t data_block_size;
966 +
967 ++ /*
968 ++ * We reserve a section of the metadata for commit overhead.
969 ++ * All reported space does *not* include this.
970 ++ */
971 ++ dm_block_t metadata_reserve;
972 ++
973 + /*
974 + * Set if a transaction has to be aborted but the attempt to roll back
975 + * to the previous (good) transaction failed. The only pool metadata
976 +@@ -827,6 +833,20 @@ static int __commit_transaction(struct dm_pool_metadata *pmd)
977 + return dm_tm_commit(pmd->tm, sblock);
978 + }
979 +
980 ++static void __set_metadata_reserve(struct dm_pool_metadata *pmd)
981 ++{
982 ++ int r;
983 ++ dm_block_t total;
984 ++ dm_block_t max_blocks = 4096; /* 16M */
985 ++
986 ++ r = dm_sm_get_nr_blocks(pmd->metadata_sm, &total);
987 ++ if (r) {
988 ++ DMERR("could not get size of metadata device");
989 ++ pmd->metadata_reserve = max_blocks;
990 ++ } else
991 ++ pmd->metadata_reserve = min(max_blocks, div_u64(total, 10));
992 ++}
993 ++
994 + struct dm_pool_metadata *dm_pool_metadata_open(struct block_device *bdev,
995 + sector_t data_block_size,
996 + bool format_device)
997 +@@ -860,6 +880,8 @@ struct dm_pool_metadata *dm_pool_metadata_open(struct block_device *bdev,
998 + return ERR_PTR(r);
999 + }
1000 +
1001 ++ __set_metadata_reserve(pmd);
1002 ++
1003 + return pmd;
1004 + }
1005 +
1006 +@@ -1763,6 +1785,13 @@ int dm_pool_get_free_metadata_block_count(struct dm_pool_metadata *pmd,
1007 + down_read(&pmd->root_lock);
1008 + if (!pmd->fail_io)
1009 + r = dm_sm_get_nr_free(pmd->metadata_sm, result);
1010 ++
1011 ++ if (!r) {
1012 ++ if (*result < pmd->metadata_reserve)
1013 ++ *result = 0;
1014 ++ else
1015 ++ *result -= pmd->metadata_reserve;
1016 ++ }
1017 + up_read(&pmd->root_lock);
1018 +
1019 + return r;
1020 +@@ -1875,8 +1904,11 @@ int dm_pool_resize_metadata_dev(struct dm_pool_metadata *pmd, dm_block_t new_cou
1021 + int r = -EINVAL;
1022 +
1023 + down_write(&pmd->root_lock);
1024 +- if (!pmd->fail_io)
1025 ++ if (!pmd->fail_io) {
1026 + r = __resize_space_map(pmd->metadata_sm, new_count);
1027 ++ if (!r)
1028 ++ __set_metadata_reserve(pmd);
1029 ++ }
1030 + up_write(&pmd->root_lock);
1031 +
1032 + return r;
1033 +diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
1034 +index 315767e8ae4d..bc4e6825ff62 100644
1035 +--- a/drivers/md/dm-thin.c
1036 ++++ b/drivers/md/dm-thin.c
1037 +@@ -200,7 +200,13 @@ struct dm_thin_new_mapping;
1038 + enum pool_mode {
1039 + PM_WRITE, /* metadata may be changed */
1040 + PM_OUT_OF_DATA_SPACE, /* metadata may be changed, though data may not be allocated */
1041 ++
1042 ++ /*
1043 ++ * Like READ_ONLY, except may switch back to WRITE on metadata resize. Reported as READ_ONLY.
1044 ++ */
1045 ++ PM_OUT_OF_METADATA_SPACE,
1046 + PM_READ_ONLY, /* metadata may not be changed */
1047 ++
1048 + PM_FAIL, /* all I/O fails */
1049 + };
1050 +
1051 +@@ -1301,7 +1307,35 @@ static void set_pool_mode(struct pool *pool, enum pool_mode new_mode);
1052 +
1053 + static void requeue_bios(struct pool *pool);
1054 +
1055 +-static void check_for_space(struct pool *pool)
1056 ++static bool is_read_only_pool_mode(enum pool_mode mode)
1057 ++{
1058 ++ return (mode == PM_OUT_OF_METADATA_SPACE || mode == PM_READ_ONLY);
1059 ++}
1060 ++
1061 ++static bool is_read_only(struct pool *pool)
1062 ++{
1063 ++ return is_read_only_pool_mode(get_pool_mode(pool));
1064 ++}
1065 ++
1066 ++static void check_for_metadata_space(struct pool *pool)
1067 ++{
1068 ++ int r;
1069 ++ const char *ooms_reason = NULL;
1070 ++ dm_block_t nr_free;
1071 ++
1072 ++ r = dm_pool_get_free_metadata_block_count(pool->pmd, &nr_free);
1073 ++ if (r)
1074 ++ ooms_reason = "Could not get free metadata blocks";
1075 ++ else if (!nr_free)
1076 ++ ooms_reason = "No free metadata blocks";
1077 ++
1078 ++ if (ooms_reason && !is_read_only(pool)) {
1079 ++ DMERR("%s", ooms_reason);
1080 ++ set_pool_mode(pool, PM_OUT_OF_METADATA_SPACE);
1081 ++ }
1082 ++}
1083 ++
1084 ++static void check_for_data_space(struct pool *pool)
1085 + {
1086 + int r;
1087 + dm_block_t nr_free;
1088 +@@ -1327,14 +1361,16 @@ static int commit(struct pool *pool)
1089 + {
1090 + int r;
1091 +
1092 +- if (get_pool_mode(pool) >= PM_READ_ONLY)
1093 ++ if (get_pool_mode(pool) >= PM_OUT_OF_METADATA_SPACE)
1094 + return -EINVAL;
1095 +
1096 + r = dm_pool_commit_metadata(pool->pmd);
1097 + if (r)
1098 + metadata_operation_failed(pool, "dm_pool_commit_metadata", r);
1099 +- else
1100 +- check_for_space(pool);
1101 ++ else {
1102 ++ check_for_metadata_space(pool);
1103 ++ check_for_data_space(pool);
1104 ++ }
1105 +
1106 + return r;
1107 + }
1108 +@@ -1400,6 +1436,19 @@ static int alloc_data_block(struct thin_c *tc, dm_block_t *result)
1109 + return r;
1110 + }
1111 +
1112 ++ r = dm_pool_get_free_metadata_block_count(pool->pmd, &free_blocks);
1113 ++ if (r) {
1114 ++ metadata_operation_failed(pool, "dm_pool_get_free_metadata_block_count", r);
1115 ++ return r;
1116 ++ }
1117 ++
1118 ++ if (!free_blocks) {
1119 ++ /* Let's commit before we use up the metadata reserve. */
1120 ++ r = commit(pool);
1121 ++ if (r)
1122 ++ return r;
1123 ++ }
1124 ++
1125 + return 0;
1126 + }
1127 +
1128 +@@ -1431,6 +1480,7 @@ static int should_error_unserviceable_bio(struct pool *pool)
1129 + case PM_OUT_OF_DATA_SPACE:
1130 + return pool->pf.error_if_no_space ? -ENOSPC : 0;
1131 +
1132 ++ case PM_OUT_OF_METADATA_SPACE:
1133 + case PM_READ_ONLY:
1134 + case PM_FAIL:
1135 + return -EIO;
1136 +@@ -2401,8 +2451,9 @@ static void set_pool_mode(struct pool *pool, enum pool_mode new_mode)
1137 + error_retry_list(pool);
1138 + break;
1139 +
1140 ++ case PM_OUT_OF_METADATA_SPACE:
1141 + case PM_READ_ONLY:
1142 +- if (old_mode != new_mode)
1143 ++ if (!is_read_only_pool_mode(old_mode))
1144 + notify_of_pool_mode_change(pool, "read-only");
1145 + dm_pool_metadata_read_only(pool->pmd);
1146 + pool->process_bio = process_bio_read_only;
1147 +@@ -3333,6 +3384,10 @@ static int maybe_resize_metadata_dev(struct dm_target *ti, bool *need_commit)
1148 + DMINFO("%s: growing the metadata device from %llu to %llu blocks",
1149 + dm_device_name(pool->pool_md),
1150 + sb_metadata_dev_size, metadata_dev_size);
1151 ++
1152 ++ if (get_pool_mode(pool) == PM_OUT_OF_METADATA_SPACE)
1153 ++ set_pool_mode(pool, PM_WRITE);
1154 ++
1155 + r = dm_pool_resize_metadata_dev(pool->pmd, metadata_dev_size);
1156 + if (r) {
1157 + metadata_operation_failed(pool, "dm_pool_resize_metadata_dev", r);
1158 +@@ -3636,7 +3691,7 @@ static int pool_message(struct dm_target *ti, unsigned argc, char **argv)
1159 + struct pool_c *pt = ti->private;
1160 + struct pool *pool = pt->pool;
1161 +
1162 +- if (get_pool_mode(pool) >= PM_READ_ONLY) {
1163 ++ if (get_pool_mode(pool) >= PM_OUT_OF_METADATA_SPACE) {
1164 + DMERR("%s: unable to service pool target messages in READ_ONLY or FAIL mode",
1165 + dm_device_name(pool->pool_md));
1166 + return -EOPNOTSUPP;
1167 +@@ -3710,6 +3765,7 @@ static void pool_status(struct dm_target *ti, status_type_t type,
1168 + dm_block_t nr_blocks_data;
1169 + dm_block_t nr_blocks_metadata;
1170 + dm_block_t held_root;
1171 ++ enum pool_mode mode;
1172 + char buf[BDEVNAME_SIZE];
1173 + char buf2[BDEVNAME_SIZE];
1174 + struct pool_c *pt = ti->private;
1175 +@@ -3780,9 +3836,10 @@ static void pool_status(struct dm_target *ti, status_type_t type,
1176 + else
1177 + DMEMIT("- ");
1178 +
1179 +- if (pool->pf.mode == PM_OUT_OF_DATA_SPACE)
1180 ++ mode = get_pool_mode(pool);
1181 ++ if (mode == PM_OUT_OF_DATA_SPACE)
1182 + DMEMIT("out_of_data_space ");
1183 +- else if (pool->pf.mode == PM_READ_ONLY)
1184 ++ else if (is_read_only_pool_mode(mode))
1185 + DMEMIT("ro ");
1186 + else
1187 + DMEMIT("rw ");
1188 +diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
1189 +index a7a561af05c9..617a0aefc1c4 100644
1190 +--- a/drivers/md/md-cluster.c
1191 ++++ b/drivers/md/md-cluster.c
1192 +@@ -239,15 +239,6 @@ static void recover_bitmaps(struct md_thread *thread)
1193 + while (cinfo->recovery_map) {
1194 + slot = fls64((u64)cinfo->recovery_map) - 1;
1195 +
1196 +- /* Clear suspend_area associated with the bitmap */
1197 +- spin_lock_irq(&cinfo->suspend_lock);
1198 +- list_for_each_entry_safe(s, tmp, &cinfo->suspend_list, list)
1199 +- if (slot == s->slot) {
1200 +- list_del(&s->list);
1201 +- kfree(s);
1202 +- }
1203 +- spin_unlock_irq(&cinfo->suspend_lock);
1204 +-
1205 + snprintf(str, 64, "bitmap%04d", slot);
1206 + bm_lockres = lockres_init(mddev, str, NULL, 1);
1207 + if (!bm_lockres) {
1208 +@@ -266,6 +257,16 @@ static void recover_bitmaps(struct md_thread *thread)
1209 + pr_err("md-cluster: Could not copy data from bitmap %d\n", slot);
1210 + goto dlm_unlock;
1211 + }
1212 ++
1213 ++ /* Clear suspend_area associated with the bitmap */
1214 ++ spin_lock_irq(&cinfo->suspend_lock);
1215 ++ list_for_each_entry_safe(s, tmp, &cinfo->suspend_list, list)
1216 ++ if (slot == s->slot) {
1217 ++ list_del(&s->list);
1218 ++ kfree(s);
1219 ++ }
1220 ++ spin_unlock_irq(&cinfo->suspend_lock);
1221 ++
1222 + if (hi > 0) {
1223 + /* TODO:Wait for current resync to get over */
1224 + set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
1225 +diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
1226 +index 8a731bdd268e..89111d455b71 100644
1227 +--- a/drivers/md/raid10.c
1228 ++++ b/drivers/md/raid10.c
1229 +@@ -4336,11 +4336,12 @@ static sector_t reshape_request(struct mddev *mddev, sector_t sector_nr,
1230 + allow_barrier(conf);
1231 + }
1232 +
1233 ++ raise_barrier(conf, 0);
1234 + read_more:
1235 + /* Now schedule reads for blocks from sector_nr to last */
1236 + r10_bio = mempool_alloc(conf->r10buf_pool, GFP_NOIO);
1237 + r10_bio->state = 0;
1238 +- raise_barrier(conf, sectors_done != 0);
1239 ++ raise_barrier(conf, 1);
1240 + atomic_set(&r10_bio->remaining, 0);
1241 + r10_bio->mddev = mddev;
1242 + r10_bio->sector = sector_nr;
1243 +@@ -4445,6 +4446,8 @@ bio_full:
1244 + if (sector_nr <= last)
1245 + goto read_more;
1246 +
1247 ++ lower_barrier(conf);
1248 ++
1249 + /* Now that we have done the whole section we can
1250 + * update reshape_progress
1251 + */
1252 +diff --git a/drivers/media/i2c/soc_camera/ov772x.c b/drivers/media/i2c/soc_camera/ov772x.c
1253 +index f150a8bd94dc..70f1a80d4e39 100644
1254 +--- a/drivers/media/i2c/soc_camera/ov772x.c
1255 ++++ b/drivers/media/i2c/soc_camera/ov772x.c
1256 +@@ -834,7 +834,7 @@ static int ov772x_set_params(struct ov772x_priv *priv,
1257 + * set COM8
1258 + */
1259 + if (priv->band_filter) {
1260 +- ret = ov772x_mask_set(client, COM8, BNDF_ON_OFF, 1);
1261 ++ ret = ov772x_mask_set(client, COM8, BNDF_ON_OFF, BNDF_ON_OFF);
1262 + if (!ret)
1263 + ret = ov772x_mask_set(client, BDBASE,
1264 + 0xff, 256 - priv->band_filter);
1265 +diff --git a/drivers/media/platform/exynos4-is/fimc-isp-video.c b/drivers/media/platform/exynos4-is/fimc-isp-video.c
1266 +index 6e6648446f00..667d3720154a 100644
1267 +--- a/drivers/media/platform/exynos4-is/fimc-isp-video.c
1268 ++++ b/drivers/media/platform/exynos4-is/fimc-isp-video.c
1269 +@@ -391,12 +391,17 @@ static void __isp_video_try_fmt(struct fimc_isp *isp,
1270 + struct v4l2_pix_format_mplane *pixm,
1271 + const struct fimc_fmt **fmt)
1272 + {
1273 +- *fmt = fimc_isp_find_format(&pixm->pixelformat, NULL, 2);
1274 ++ const struct fimc_fmt *__fmt;
1275 ++
1276 ++ __fmt = fimc_isp_find_format(&pixm->pixelformat, NULL, 2);
1277 ++
1278 ++ if (fmt)
1279 ++ *fmt = __fmt;
1280 +
1281 + pixm->colorspace = V4L2_COLORSPACE_SRGB;
1282 + pixm->field = V4L2_FIELD_NONE;
1283 +- pixm->num_planes = (*fmt)->memplanes;
1284 +- pixm->pixelformat = (*fmt)->fourcc;
1285 ++ pixm->num_planes = __fmt->memplanes;
1286 ++ pixm->pixelformat = __fmt->fourcc;
1287 + /*
1288 + * TODO: double check with the docmentation these width/height
1289 + * constraints are correct.
1290 +diff --git a/drivers/media/platform/fsl-viu.c b/drivers/media/platform/fsl-viu.c
1291 +index ae8c6b35a357..7f0ed5a26da9 100644
1292 +--- a/drivers/media/platform/fsl-viu.c
1293 ++++ b/drivers/media/platform/fsl-viu.c
1294 +@@ -1417,7 +1417,7 @@ static int viu_of_probe(struct platform_device *op)
1295 + sizeof(struct viu_reg), DRV_NAME)) {
1296 + dev_err(&op->dev, "Error while requesting mem region\n");
1297 + ret = -EBUSY;
1298 +- goto err;
1299 ++ goto err_irq;
1300 + }
1301 +
1302 + /* remap registers */
1303 +@@ -1425,7 +1425,7 @@ static int viu_of_probe(struct platform_device *op)
1304 + if (!viu_regs) {
1305 + dev_err(&op->dev, "Can't map register set\n");
1306 + ret = -ENOMEM;
1307 +- goto err;
1308 ++ goto err_irq;
1309 + }
1310 +
1311 + /* Prepare our private structure */
1312 +@@ -1433,7 +1433,7 @@ static int viu_of_probe(struct platform_device *op)
1313 + if (!viu_dev) {
1314 + dev_err(&op->dev, "Can't allocate private structure\n");
1315 + ret = -ENOMEM;
1316 +- goto err;
1317 ++ goto err_irq;
1318 + }
1319 +
1320 + viu_dev->vr = viu_regs;
1321 +@@ -1449,16 +1449,21 @@ static int viu_of_probe(struct platform_device *op)
1322 + ret = v4l2_device_register(viu_dev->dev, &viu_dev->v4l2_dev);
1323 + if (ret < 0) {
1324 + dev_err(&op->dev, "v4l2_device_register() failed: %d\n", ret);
1325 +- goto err;
1326 ++ goto err_irq;
1327 + }
1328 +
1329 + ad = i2c_get_adapter(0);
1330 ++ if (!ad) {
1331 ++ ret = -EFAULT;
1332 ++ dev_err(&op->dev, "couldn't get i2c adapter\n");
1333 ++ goto err_v4l2;
1334 ++ }
1335 +
1336 + v4l2_ctrl_handler_init(&viu_dev->hdl, 5);
1337 + if (viu_dev->hdl.error) {
1338 + ret = viu_dev->hdl.error;
1339 + dev_err(&op->dev, "couldn't register control\n");
1340 +- goto err_vdev;
1341 ++ goto err_i2c;
1342 + }
1343 + /* This control handler will inherit the control(s) from the
1344 + sub-device(s). */
1345 +@@ -1476,7 +1481,7 @@ static int viu_of_probe(struct platform_device *op)
1346 + vdev = video_device_alloc();
1347 + if (vdev == NULL) {
1348 + ret = -ENOMEM;
1349 +- goto err_vdev;
1350 ++ goto err_hdl;
1351 + }
1352 +
1353 + *vdev = viu_template;
1354 +@@ -1497,7 +1502,7 @@ static int viu_of_probe(struct platform_device *op)
1355 + ret = video_register_device(viu_dev->vdev, VFL_TYPE_GRABBER, -1);
1356 + if (ret < 0) {
1357 + video_device_release(viu_dev->vdev);
1358 +- goto err_vdev;
1359 ++ goto err_unlock;
1360 + }
1361 +
1362 + /* enable VIU clock */
1363 +@@ -1505,12 +1510,12 @@ static int viu_of_probe(struct platform_device *op)
1364 + if (IS_ERR(clk)) {
1365 + dev_err(&op->dev, "failed to lookup the clock!\n");
1366 + ret = PTR_ERR(clk);
1367 +- goto err_clk;
1368 ++ goto err_vdev;
1369 + }
1370 + ret = clk_prepare_enable(clk);
1371 + if (ret) {
1372 + dev_err(&op->dev, "failed to enable the clock!\n");
1373 +- goto err_clk;
1374 ++ goto err_vdev;
1375 + }
1376 + viu_dev->clk = clk;
1377 +
1378 +@@ -1521,7 +1526,7 @@ static int viu_of_probe(struct platform_device *op)
1379 + if (request_irq(viu_dev->irq, viu_intr, 0, "viu", (void *)viu_dev)) {
1380 + dev_err(&op->dev, "Request VIU IRQ failed.\n");
1381 + ret = -ENODEV;
1382 +- goto err_irq;
1383 ++ goto err_clk;
1384 + }
1385 +
1386 + mutex_unlock(&viu_dev->lock);
1387 +@@ -1529,16 +1534,19 @@ static int viu_of_probe(struct platform_device *op)
1388 + dev_info(&op->dev, "Freescale VIU Video Capture Board\n");
1389 + return ret;
1390 +
1391 +-err_irq:
1392 +- clk_disable_unprepare(viu_dev->clk);
1393 + err_clk:
1394 +- video_unregister_device(viu_dev->vdev);
1395 ++ clk_disable_unprepare(viu_dev->clk);
1396 + err_vdev:
1397 +- v4l2_ctrl_handler_free(&viu_dev->hdl);
1398 ++ video_unregister_device(viu_dev->vdev);
1399 ++err_unlock:
1400 + mutex_unlock(&viu_dev->lock);
1401 ++err_hdl:
1402 ++ v4l2_ctrl_handler_free(&viu_dev->hdl);
1403 ++err_i2c:
1404 + i2c_put_adapter(ad);
1405 ++err_v4l2:
1406 + v4l2_device_unregister(&viu_dev->v4l2_dev);
1407 +-err:
1408 ++err_irq:
1409 + irq_dispose_mapping(viu_irq);
1410 + return ret;
1411 + }
1412 +diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
1413 +index 91e02c1ff392..136ea1848701 100644
1414 +--- a/drivers/media/platform/omap3isp/isp.c
1415 ++++ b/drivers/media/platform/omap3isp/isp.c
1416 +@@ -303,7 +303,7 @@ static struct clk *isp_xclk_src_get(struct of_phandle_args *clkspec, void *data)
1417 + static int isp_xclk_init(struct isp_device *isp)
1418 + {
1419 + struct device_node *np = isp->dev->of_node;
1420 +- struct clk_init_data init;
1421 ++ struct clk_init_data init = { 0 };
1422 + unsigned int i;
1423 +
1424 + for (i = 0; i < ARRAY_SIZE(isp->xclks); ++i)
1425 +diff --git a/drivers/media/platform/s3c-camif/camif-capture.c b/drivers/media/platform/s3c-camif/camif-capture.c
1426 +index fa6af4a7dae1..f97f4bc22ced 100644
1427 +--- a/drivers/media/platform/s3c-camif/camif-capture.c
1428 ++++ b/drivers/media/platform/s3c-camif/camif-capture.c
1429 +@@ -117,6 +117,8 @@ static int sensor_set_power(struct camif_dev *camif, int on)
1430 +
1431 + if (camif->sensor.power_count == !on)
1432 + err = v4l2_subdev_call(sensor->sd, core, s_power, on);
1433 ++ if (err == -ENOIOCTLCMD)
1434 ++ err = 0;
1435 + if (!err)
1436 + sensor->power_count += on ? 1 : -1;
1437 +
1438 +diff --git a/drivers/media/usb/tm6000/tm6000-dvb.c b/drivers/media/usb/tm6000/tm6000-dvb.c
1439 +index 095f5db1a790..4f317e2686e9 100644
1440 +--- a/drivers/media/usb/tm6000/tm6000-dvb.c
1441 ++++ b/drivers/media/usb/tm6000/tm6000-dvb.c
1442 +@@ -275,6 +275,11 @@ static int register_dvb(struct tm6000_core *dev)
1443 +
1444 + ret = dvb_register_adapter(&dvb->adapter, "Trident TVMaster 6000 DVB-T",
1445 + THIS_MODULE, &dev->udev->dev, adapter_nr);
1446 ++ if (ret < 0) {
1447 ++ pr_err("tm6000: couldn't register the adapter!\n");
1448 ++ goto err;
1449 ++ }
1450 ++
1451 + dvb->adapter.priv = dev;
1452 +
1453 + if (dvb->frontend) {
1454 +diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
1455 +index 2b276ab7764f..a4048a04d236 100644
1456 +--- a/drivers/media/usb/uvc/uvc_video.c
1457 ++++ b/drivers/media/usb/uvc/uvc_video.c
1458 +@@ -163,14 +163,27 @@ static void uvc_fixup_video_ctrl(struct uvc_streaming *stream,
1459 + }
1460 + }
1461 +
1462 ++static size_t uvc_video_ctrl_size(struct uvc_streaming *stream)
1463 ++{
1464 ++ /*
1465 ++ * Return the size of the video probe and commit controls, which depends
1466 ++ * on the protocol version.
1467 ++ */
1468 ++ if (stream->dev->uvc_version < 0x0110)
1469 ++ return 26;
1470 ++ else if (stream->dev->uvc_version < 0x0150)
1471 ++ return 34;
1472 ++ else
1473 ++ return 48;
1474 ++}
1475 ++
1476 + static int uvc_get_video_ctrl(struct uvc_streaming *stream,
1477 + struct uvc_streaming_control *ctrl, int probe, __u8 query)
1478 + {
1479 ++ __u16 size = uvc_video_ctrl_size(stream);
1480 + __u8 *data;
1481 +- __u16 size;
1482 + int ret;
1483 +
1484 +- size = stream->dev->uvc_version >= 0x0110 ? 34 : 26;
1485 + if ((stream->dev->quirks & UVC_QUIRK_PROBE_DEF) &&
1486 + query == UVC_GET_DEF)
1487 + return -EIO;
1488 +@@ -225,7 +238,7 @@ static int uvc_get_video_ctrl(struct uvc_streaming *stream,
1489 + ctrl->dwMaxVideoFrameSize = get_unaligned_le32(&data[18]);
1490 + ctrl->dwMaxPayloadTransferSize = get_unaligned_le32(&data[22]);
1491 +
1492 +- if (size == 34) {
1493 ++ if (size >= 34) {
1494 + ctrl->dwClockFrequency = get_unaligned_le32(&data[26]);
1495 + ctrl->bmFramingInfo = data[30];
1496 + ctrl->bPreferedVersion = data[31];
1497 +@@ -254,11 +267,10 @@ out:
1498 + static int uvc_set_video_ctrl(struct uvc_streaming *stream,
1499 + struct uvc_streaming_control *ctrl, int probe)
1500 + {
1501 ++ __u16 size = uvc_video_ctrl_size(stream);
1502 + __u8 *data;
1503 +- __u16 size;
1504 + int ret;
1505 +
1506 +- size = stream->dev->uvc_version >= 0x0110 ? 34 : 26;
1507 + data = kzalloc(size, GFP_KERNEL);
1508 + if (data == NULL)
1509 + return -ENOMEM;
1510 +@@ -275,7 +287,7 @@ static int uvc_set_video_ctrl(struct uvc_streaming *stream,
1511 + put_unaligned_le32(ctrl->dwMaxVideoFrameSize, &data[18]);
1512 + put_unaligned_le32(ctrl->dwMaxPayloadTransferSize, &data[22]);
1513 +
1514 +- if (size == 34) {
1515 ++ if (size >= 34) {
1516 + put_unaligned_le32(ctrl->dwClockFrequency, &data[26]);
1517 + data[30] = ctrl->bmFramingInfo;
1518 + data[31] = ctrl->bPreferedVersion;
1519 +diff --git a/drivers/media/v4l2-core/v4l2-event.c b/drivers/media/v4l2-core/v4l2-event.c
1520 +index 8d3171c6bee8..b47ac4e053d0 100644
1521 +--- a/drivers/media/v4l2-core/v4l2-event.c
1522 ++++ b/drivers/media/v4l2-core/v4l2-event.c
1523 +@@ -119,14 +119,6 @@ static void __v4l2_event_queue_fh(struct v4l2_fh *fh, const struct v4l2_event *e
1524 + if (sev == NULL)
1525 + return;
1526 +
1527 +- /*
1528 +- * If the event has been added to the fh->subscribed list, but its
1529 +- * add op has not completed yet elems will be 0, treat this as
1530 +- * not being subscribed.
1531 +- */
1532 +- if (!sev->elems)
1533 +- return;
1534 +-
1535 + /* Increase event sequence number on fh. */
1536 + fh->sequence++;
1537 +
1538 +@@ -212,6 +204,7 @@ int v4l2_event_subscribe(struct v4l2_fh *fh,
1539 + struct v4l2_subscribed_event *sev, *found_ev;
1540 + unsigned long flags;
1541 + unsigned i;
1542 ++ int ret = 0;
1543 +
1544 + if (sub->type == V4L2_EVENT_ALL)
1545 + return -EINVAL;
1546 +@@ -229,31 +222,36 @@ int v4l2_event_subscribe(struct v4l2_fh *fh,
1547 + sev->flags = sub->flags;
1548 + sev->fh = fh;
1549 + sev->ops = ops;
1550 ++ sev->elems = elems;
1551 ++
1552 ++ mutex_lock(&fh->subscribe_lock);
1553 +
1554 + spin_lock_irqsave(&fh->vdev->fh_lock, flags);
1555 + found_ev = v4l2_event_subscribed(fh, sub->type, sub->id);
1556 +- if (!found_ev)
1557 +- list_add(&sev->list, &fh->subscribed);
1558 + spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
1559 +
1560 + if (found_ev) {
1561 ++ /* Already listening */
1562 + kfree(sev);
1563 +- return 0; /* Already listening */
1564 ++ goto out_unlock;
1565 + }
1566 +
1567 + if (sev->ops && sev->ops->add) {
1568 +- int ret = sev->ops->add(sev, elems);
1569 ++ ret = sev->ops->add(sev, elems);
1570 + if (ret) {
1571 +- sev->ops = NULL;
1572 +- v4l2_event_unsubscribe(fh, sub);
1573 +- return ret;
1574 ++ kfree(sev);
1575 ++ goto out_unlock;
1576 + }
1577 + }
1578 +
1579 +- /* Mark as ready for use */
1580 +- sev->elems = elems;
1581 ++ spin_lock_irqsave(&fh->vdev->fh_lock, flags);
1582 ++ list_add(&sev->list, &fh->subscribed);
1583 ++ spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
1584 +
1585 +- return 0;
1586 ++out_unlock:
1587 ++ mutex_unlock(&fh->subscribe_lock);
1588 ++
1589 ++ return ret;
1590 + }
1591 + EXPORT_SYMBOL_GPL(v4l2_event_subscribe);
1592 +
1593 +@@ -292,6 +290,8 @@ int v4l2_event_unsubscribe(struct v4l2_fh *fh,
1594 + return 0;
1595 + }
1596 +
1597 ++ mutex_lock(&fh->subscribe_lock);
1598 ++
1599 + spin_lock_irqsave(&fh->vdev->fh_lock, flags);
1600 +
1601 + sev = v4l2_event_subscribed(fh, sub->type, sub->id);
1602 +@@ -310,6 +310,7 @@ int v4l2_event_unsubscribe(struct v4l2_fh *fh,
1603 + sev->ops->del(sev);
1604 +
1605 + kfree(sev);
1606 ++ mutex_unlock(&fh->subscribe_lock);
1607 +
1608 + return 0;
1609 + }
1610 +diff --git a/drivers/media/v4l2-core/v4l2-fh.c b/drivers/media/v4l2-core/v4l2-fh.c
1611 +index c97067a25bd2..1d076deb05a9 100644
1612 +--- a/drivers/media/v4l2-core/v4l2-fh.c
1613 ++++ b/drivers/media/v4l2-core/v4l2-fh.c
1614 +@@ -49,6 +49,7 @@ void v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev)
1615 + INIT_LIST_HEAD(&fh->available);
1616 + INIT_LIST_HEAD(&fh->subscribed);
1617 + fh->sequence = -1;
1618 ++ mutex_init(&fh->subscribe_lock);
1619 + }
1620 + EXPORT_SYMBOL_GPL(v4l2_fh_init);
1621 +
1622 +@@ -93,6 +94,7 @@ void v4l2_fh_exit(struct v4l2_fh *fh)
1623 + if (fh->vdev == NULL)
1624 + return;
1625 + v4l2_event_unsubscribe_all(fh);
1626 ++ mutex_destroy(&fh->subscribe_lock);
1627 + fh->vdev = NULL;
1628 + }
1629 + EXPORT_SYMBOL_GPL(v4l2_fh_exit);
1630 +diff --git a/drivers/misc/tsl2550.c b/drivers/misc/tsl2550.c
1631 +index 87a13374fdc0..eb5761067310 100644
1632 +--- a/drivers/misc/tsl2550.c
1633 ++++ b/drivers/misc/tsl2550.c
1634 +@@ -177,7 +177,7 @@ static int tsl2550_calculate_lux(u8 ch0, u8 ch1)
1635 + } else
1636 + lux = 0;
1637 + else
1638 +- return -EAGAIN;
1639 ++ return 0;
1640 +
1641 + /* LUX range check */
1642 + return lux > TSL2550_MAX_LUX ? TSL2550_MAX_LUX : lux;
1643 +diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c
1644 +index cc277f7849b0..3877f534fd3f 100644
1645 +--- a/drivers/misc/vmw_vmci/vmci_queue_pair.c
1646 ++++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c
1647 +@@ -755,7 +755,7 @@ static int qp_host_get_user_memory(u64 produce_uva,
1648 + retval = get_user_pages_fast((uintptr_t) produce_uva,
1649 + produce_q->kernel_if->num_pages, 1,
1650 + produce_q->kernel_if->u.h.header_page);
1651 +- if (retval < produce_q->kernel_if->num_pages) {
1652 ++ if (retval < (int)produce_q->kernel_if->num_pages) {
1653 + pr_debug("get_user_pages_fast(produce) failed (retval=%d)",
1654 + retval);
1655 + qp_release_pages(produce_q->kernel_if->u.h.header_page,
1656 +@@ -767,7 +767,7 @@ static int qp_host_get_user_memory(u64 produce_uva,
1657 + retval = get_user_pages_fast((uintptr_t) consume_uva,
1658 + consume_q->kernel_if->num_pages, 1,
1659 + consume_q->kernel_if->u.h.header_page);
1660 +- if (retval < consume_q->kernel_if->num_pages) {
1661 ++ if (retval < (int)consume_q->kernel_if->num_pages) {
1662 + pr_debug("get_user_pages_fast(consume) failed (retval=%d)",
1663 + retval);
1664 + qp_release_pages(consume_q->kernel_if->u.h.header_page,
1665 +diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
1666 +index 8d54e7b41bbf..8c698d464716 100644
1667 +--- a/drivers/net/ethernet/cadence/macb.c
1668 ++++ b/drivers/net/ethernet/cadence/macb.c
1669 +@@ -523,7 +523,7 @@ static int macb_halt_tx(struct macb *bp)
1670 + if (!(status & MACB_BIT(TGO)))
1671 + return 0;
1672 +
1673 +- usleep_range(10, 250);
1674 ++ udelay(250);
1675 + } while (time_before(halt_time, timeout));
1676 +
1677 + return -ETIMEDOUT;
1678 +diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.h b/drivers/net/ethernet/hisilicon/hns/hnae.h
1679 +index cec95ac8687d..fe37fc7ec76e 100644
1680 +--- a/drivers/net/ethernet/hisilicon/hns/hnae.h
1681 ++++ b/drivers/net/ethernet/hisilicon/hns/hnae.h
1682 +@@ -171,10 +171,10 @@ struct hnae_desc_cb {
1683 +
1684 + /* priv data for the desc, e.g. skb when use with ip stack*/
1685 + void *priv;
1686 +- u16 page_offset;
1687 +- u16 reuse_flag;
1688 ++ u32 page_offset;
1689 ++ u32 length; /* length of the buffer */
1690 +
1691 +- u16 length; /* length of the buffer */
1692 ++ u16 reuse_flag;
1693 +
1694 + /* desc type, used by the ring user to mark the type of the priv data */
1695 + u16 type;
1696 +diff --git a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
1697 +index 83e557c7f279..5ae8874bbf72 100644
1698 +--- a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
1699 ++++ b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
1700 +@@ -645,14 +645,14 @@ static int e1000_set_ringparam(struct net_device *netdev,
1701 + adapter->tx_ring = tx_old;
1702 + e1000_free_all_rx_resources(adapter);
1703 + e1000_free_all_tx_resources(adapter);
1704 +- kfree(tx_old);
1705 +- kfree(rx_old);
1706 + adapter->rx_ring = rxdr;
1707 + adapter->tx_ring = txdr;
1708 + err = e1000_up(adapter);
1709 + if (err)
1710 + goto err_setup;
1711 + }
1712 ++ kfree(tx_old);
1713 ++ kfree(rx_old);
1714 +
1715 + clear_bit(__E1000_RESETTING, &adapter->flags);
1716 + return 0;
1717 +@@ -665,7 +665,8 @@ err_setup_rx:
1718 + err_alloc_rx:
1719 + kfree(txdr);
1720 + err_alloc_tx:
1721 +- e1000_up(adapter);
1722 ++ if (netif_running(adapter->netdev))
1723 ++ e1000_up(adapter);
1724 + err_setup:
1725 + clear_bit(__E1000_RESETTING, &adapter->flags);
1726 + return err;
1727 +diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
1728 +index 8b4069ea52ce..c6782ebd35e1 100644
1729 +--- a/drivers/net/ethernet/realtek/r8169.c
1730 ++++ b/drivers/net/ethernet/realtek/r8169.c
1731 +@@ -759,7 +759,7 @@ struct rtl8169_tc_offsets {
1732 + };
1733 +
1734 + enum rtl_flag {
1735 +- RTL_FLAG_TASK_ENABLED,
1736 ++ RTL_FLAG_TASK_ENABLED = 0,
1737 + RTL_FLAG_TASK_SLOW_PENDING,
1738 + RTL_FLAG_TASK_RESET_PENDING,
1739 + RTL_FLAG_TASK_PHY_PENDING,
1740 +@@ -7618,7 +7618,8 @@ static int rtl8169_close(struct net_device *dev)
1741 + rtl8169_update_counters(dev);
1742 +
1743 + rtl_lock_work(tp);
1744 +- clear_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags);
1745 ++ /* Clear all task flags */
1746 ++ bitmap_zero(tp->wk.flags, RTL_FLAG_MAX);
1747 +
1748 + rtl8169_down(dev);
1749 + rtl_unlock_work(tp);
1750 +@@ -7795,7 +7796,9 @@ static void rtl8169_net_suspend(struct net_device *dev)
1751 +
1752 + rtl_lock_work(tp);
1753 + napi_disable(&tp->napi);
1754 +- clear_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags);
1755 ++ /* Clear all task flags */
1756 ++ bitmap_zero(tp->wk.flags, RTL_FLAG_MAX);
1757 ++
1758 + rtl_unlock_work(tp);
1759 +
1760 + rtl_pll_power_down(tp);
1761 +diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
1762 +index b32c47fe926d..a65b5d7f59f4 100644
1763 +--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
1764 ++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
1765 +@@ -212,11 +212,12 @@ int ath10k_htt_rx_ring_refill(struct ath10k *ar)
1766 + spin_lock_bh(&htt->rx_ring.lock);
1767 + ret = ath10k_htt_rx_ring_fill_n(htt, (htt->rx_ring.fill_level -
1768 + htt->rx_ring.fill_cnt));
1769 +- spin_unlock_bh(&htt->rx_ring.lock);
1770 +
1771 + if (ret)
1772 + ath10k_htt_rx_ring_free(htt);
1773 +
1774 ++ spin_unlock_bh(&htt->rx_ring.lock);
1775 ++
1776 + return ret;
1777 + }
1778 +
1779 +@@ -230,7 +231,9 @@ void ath10k_htt_rx_free(struct ath10k_htt *htt)
1780 + skb_queue_purge(&htt->rx_compl_q);
1781 + skb_queue_purge(&htt->rx_in_ord_compl_q);
1782 +
1783 ++ spin_lock_bh(&htt->rx_ring.lock);
1784 + ath10k_htt_rx_ring_free(htt);
1785 ++ spin_unlock_bh(&htt->rx_ring.lock);
1786 +
1787 + dma_free_coherent(htt->ar->dev,
1788 + (htt->rx_ring.size *
1789 +diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
1790 +index e8b770a95f7a..c98cb962b454 100644
1791 +--- a/drivers/net/wireless/mac80211_hwsim.c
1792 ++++ b/drivers/net/wireless/mac80211_hwsim.c
1793 +@@ -2453,9 +2453,6 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
1794 + IEEE80211_VHT_CAP_SHORT_GI_80 |
1795 + IEEE80211_VHT_CAP_SHORT_GI_160 |
1796 + IEEE80211_VHT_CAP_TXSTBC |
1797 +- IEEE80211_VHT_CAP_RXSTBC_1 |
1798 +- IEEE80211_VHT_CAP_RXSTBC_2 |
1799 +- IEEE80211_VHT_CAP_RXSTBC_3 |
1800 + IEEE80211_VHT_CAP_RXSTBC_4 |
1801 + IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK;
1802 + sband->vht_cap.vht_mcs.rx_mcs_map =
1803 +diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
1804 +index 259590013382..c76e0cfbb8b4 100644
1805 +--- a/drivers/net/wireless/rndis_wlan.c
1806 ++++ b/drivers/net/wireless/rndis_wlan.c
1807 +@@ -2919,6 +2919,8 @@ static void rndis_wlan_auth_indication(struct usbnet *usbdev,
1808 +
1809 + while (buflen >= sizeof(*auth_req)) {
1810 + auth_req = (void *)buf;
1811 ++ if (buflen < le32_to_cpu(auth_req->length))
1812 ++ return;
1813 + type = "unknown";
1814 + flags = le32_to_cpu(auth_req->flags);
1815 + pairwise_error = false;
1816 +diff --git a/drivers/net/wireless/ti/wlcore/cmd.c b/drivers/net/wireless/ti/wlcore/cmd.c
1817 +index f01d24baff7c..15dc7a398b90 100644
1818 +--- a/drivers/net/wireless/ti/wlcore/cmd.c
1819 ++++ b/drivers/net/wireless/ti/wlcore/cmd.c
1820 +@@ -35,6 +35,7 @@
1821 + #include "wl12xx_80211.h"
1822 + #include "cmd.h"
1823 + #include "event.h"
1824 ++#include "ps.h"
1825 + #include "tx.h"
1826 + #include "hw_ops.h"
1827 +
1828 +@@ -191,6 +192,10 @@ int wlcore_cmd_wait_for_event_or_timeout(struct wl1271 *wl,
1829 +
1830 + timeout_time = jiffies + msecs_to_jiffies(WL1271_EVENT_TIMEOUT);
1831 +
1832 ++ ret = wl1271_ps_elp_wakeup(wl);
1833 ++ if (ret < 0)
1834 ++ return ret;
1835 ++
1836 + do {
1837 + if (time_after(jiffies, timeout_time)) {
1838 + wl1271_debug(DEBUG_CMD, "timeout waiting for event %d",
1839 +@@ -222,6 +227,7 @@ int wlcore_cmd_wait_for_event_or_timeout(struct wl1271 *wl,
1840 + } while (!event);
1841 +
1842 + out:
1843 ++ wl1271_ps_elp_sleep(wl);
1844 + kfree(events_vector);
1845 + return ret;
1846 + }
1847 +diff --git a/drivers/power/reset/vexpress-poweroff.c b/drivers/power/reset/vexpress-poweroff.c
1848 +index 6a9bf7089373..ccb619632e46 100644
1849 +--- a/drivers/power/reset/vexpress-poweroff.c
1850 ++++ b/drivers/power/reset/vexpress-poweroff.c
1851 +@@ -35,6 +35,7 @@ static void vexpress_reset_do(struct device *dev, const char *what)
1852 + }
1853 +
1854 + static struct device *vexpress_power_off_device;
1855 ++static atomic_t vexpress_restart_nb_refcnt = ATOMIC_INIT(0);
1856 +
1857 + static void vexpress_power_off(void)
1858 + {
1859 +@@ -99,10 +100,13 @@ static int _vexpress_register_restart_handler(struct device *dev)
1860 + int err;
1861 +
1862 + vexpress_restart_device = dev;
1863 +- err = register_restart_handler(&vexpress_restart_nb);
1864 +- if (err) {
1865 +- dev_err(dev, "cannot register restart handler (err=%d)\n", err);
1866 +- return err;
1867 ++ if (atomic_inc_return(&vexpress_restart_nb_refcnt) == 1) {
1868 ++ err = register_restart_handler(&vexpress_restart_nb);
1869 ++ if (err) {
1870 ++ dev_err(dev, "cannot register restart handler (err=%d)\n", err);
1871 ++ atomic_dec(&vexpress_restart_nb_refcnt);
1872 ++ return err;
1873 ++ }
1874 + }
1875 + device_create_file(dev, &dev_attr_active);
1876 +
1877 +diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
1878 +index acdb5ccb0ab9..34d3b7aff513 100644
1879 +--- a/drivers/s390/net/qeth_l2_main.c
1880 ++++ b/drivers/s390/net/qeth_l2_main.c
1881 +@@ -523,7 +523,7 @@ static int qeth_l2_process_inbound_buffer(struct qeth_card *card,
1882 + default:
1883 + dev_kfree_skb_any(skb);
1884 + QETH_CARD_TEXT(card, 3, "inbunkno");
1885 +- QETH_DBF_HEX(CTRL, 3, hdr, QETH_DBF_CTRL_LEN);
1886 ++ QETH_DBF_HEX(CTRL, 3, hdr, sizeof(*hdr));
1887 + continue;
1888 + }
1889 + work_done++;
1890 +diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
1891 +index bbdb3b6c54bb..2cc9bc1ef1e3 100644
1892 +--- a/drivers/s390/net/qeth_l3_main.c
1893 ++++ b/drivers/s390/net/qeth_l3_main.c
1894 +@@ -1902,7 +1902,7 @@ static int qeth_l3_process_inbound_buffer(struct qeth_card *card,
1895 + default:
1896 + dev_kfree_skb_any(skb);
1897 + QETH_CARD_TEXT(card, 3, "inbunkno");
1898 +- QETH_DBF_HEX(CTRL, 3, hdr, QETH_DBF_CTRL_LEN);
1899 ++ QETH_DBF_HEX(CTRL, 3, hdr, sizeof(*hdr));
1900 + continue;
1901 + }
1902 + work_done++;
1903 +diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
1904 +index fb072cc5e9fd..dada9ce4e702 100644
1905 +--- a/drivers/scsi/bnx2i/bnx2i_hwi.c
1906 ++++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
1907 +@@ -2742,6 +2742,8 @@ int bnx2i_map_ep_dbell_regs(struct bnx2i_endpoint *ep)
1908 + BNX2X_DOORBELL_PCI_BAR);
1909 + reg_off = (1 << BNX2X_DB_SHIFT) * (cid_num & 0x1FFFF);
1910 + ep->qp.ctx_base = ioremap_nocache(reg_base + reg_off, 4);
1911 ++ if (!ep->qp.ctx_base)
1912 ++ return -ENOMEM;
1913 + goto arm_cq;
1914 + }
1915 +
1916 +diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
1917 +index adfef9db6f1e..e26747a1b35a 100644
1918 +--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
1919 ++++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
1920 +@@ -93,7 +93,7 @@ static int max_requests = IBMVSCSI_MAX_REQUESTS_DEFAULT;
1921 + static int max_events = IBMVSCSI_MAX_REQUESTS_DEFAULT + 2;
1922 + static int fast_fail = 1;
1923 + static int client_reserve = 1;
1924 +-static char partition_name[97] = "UNKNOWN";
1925 ++static char partition_name[96] = "UNKNOWN";
1926 + static unsigned int partition_number = -1;
1927 +
1928 + static struct scsi_transport_template *ibmvscsi_transport_template;
1929 +@@ -261,7 +261,7 @@ static void gather_partition_info(void)
1930 +
1931 + ppartition_name = of_get_property(rootdn, "ibm,partition-name", NULL);
1932 + if (ppartition_name)
1933 +- strncpy(partition_name, ppartition_name,
1934 ++ strlcpy(partition_name, ppartition_name,
1935 + sizeof(partition_name));
1936 + p_number_ptr = of_get_property(rootdn, "ibm,partition-no", NULL);
1937 + if (p_number_ptr)
1938 +diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c
1939 +index 818843336932..9882d93e7566 100644
1940 +--- a/drivers/spi/spi-rspi.c
1941 ++++ b/drivers/spi/spi-rspi.c
1942 +@@ -587,11 +587,13 @@ static int rspi_dma_transfer(struct rspi_data *rspi, struct sg_table *tx,
1943 +
1944 + ret = wait_event_interruptible_timeout(rspi->wait,
1945 + rspi->dma_callbacked, HZ);
1946 +- if (ret > 0 && rspi->dma_callbacked)
1947 ++ if (ret > 0 && rspi->dma_callbacked) {
1948 + ret = 0;
1949 +- else if (!ret) {
1950 +- dev_err(&rspi->master->dev, "DMA timeout\n");
1951 +- ret = -ETIMEDOUT;
1952 ++ } else {
1953 ++ if (!ret) {
1954 ++ dev_err(&rspi->master->dev, "DMA timeout\n");
1955 ++ ret = -ETIMEDOUT;
1956 ++ }
1957 + if (tx)
1958 + dmaengine_terminate_all(rspi->master->dma_tx);
1959 + if (rx)
1960 +@@ -1303,12 +1305,36 @@ static const struct platform_device_id spi_driver_ids[] = {
1961 +
1962 + MODULE_DEVICE_TABLE(platform, spi_driver_ids);
1963 +
1964 ++#ifdef CONFIG_PM_SLEEP
1965 ++static int rspi_suspend(struct device *dev)
1966 ++{
1967 ++ struct platform_device *pdev = to_platform_device(dev);
1968 ++ struct rspi_data *rspi = platform_get_drvdata(pdev);
1969 ++
1970 ++ return spi_master_suspend(rspi->master);
1971 ++}
1972 ++
1973 ++static int rspi_resume(struct device *dev)
1974 ++{
1975 ++ struct platform_device *pdev = to_platform_device(dev);
1976 ++ struct rspi_data *rspi = platform_get_drvdata(pdev);
1977 ++
1978 ++ return spi_master_resume(rspi->master);
1979 ++}
1980 ++
1981 ++static SIMPLE_DEV_PM_OPS(rspi_pm_ops, rspi_suspend, rspi_resume);
1982 ++#define DEV_PM_OPS &rspi_pm_ops
1983 ++#else
1984 ++#define DEV_PM_OPS NULL
1985 ++#endif /* CONFIG_PM_SLEEP */
1986 ++
1987 + static struct platform_driver rspi_driver = {
1988 + .probe = rspi_probe,
1989 + .remove = rspi_remove,
1990 + .id_table = spi_driver_ids,
1991 + .driver = {
1992 + .name = "renesas_spi",
1993 ++ .pm = DEV_PM_OPS,
1994 + .of_match_table = of_match_ptr(rspi_of_match),
1995 + },
1996 + };
1997 +diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
1998 +index 3de39bd794b6..03b566848da6 100644
1999 +--- a/drivers/spi/spi-sh-msiof.c
2000 ++++ b/drivers/spi/spi-sh-msiof.c
2001 +@@ -374,7 +374,8 @@ static void sh_msiof_spi_set_mode_regs(struct sh_msiof_spi_priv *p,
2002 +
2003 + static void sh_msiof_reset_str(struct sh_msiof_spi_priv *p)
2004 + {
2005 +- sh_msiof_write(p, STR, sh_msiof_read(p, STR));
2006 ++ sh_msiof_write(p, STR,
2007 ++ sh_msiof_read(p, STR) & ~(STR_TDREQ | STR_RDREQ));
2008 + }
2009 +
2010 + static void sh_msiof_spi_write_fifo_8(struct sh_msiof_spi_priv *p,
2011 +@@ -1275,12 +1276,37 @@ static const struct platform_device_id spi_driver_ids[] = {
2012 + };
2013 + MODULE_DEVICE_TABLE(platform, spi_driver_ids);
2014 +
2015 ++#ifdef CONFIG_PM_SLEEP
2016 ++static int sh_msiof_spi_suspend(struct device *dev)
2017 ++{
2018 ++ struct platform_device *pdev = to_platform_device(dev);
2019 ++ struct sh_msiof_spi_priv *p = platform_get_drvdata(pdev);
2020 ++
2021 ++ return spi_master_suspend(p->master);
2022 ++}
2023 ++
2024 ++static int sh_msiof_spi_resume(struct device *dev)
2025 ++{
2026 ++ struct platform_device *pdev = to_platform_device(dev);
2027 ++ struct sh_msiof_spi_priv *p = platform_get_drvdata(pdev);
2028 ++
2029 ++ return spi_master_resume(p->master);
2030 ++}
2031 ++
2032 ++static SIMPLE_DEV_PM_OPS(sh_msiof_spi_pm_ops, sh_msiof_spi_suspend,
2033 ++ sh_msiof_spi_resume);
2034 ++#define DEV_PM_OPS &sh_msiof_spi_pm_ops
2035 ++#else
2036 ++#define DEV_PM_OPS NULL
2037 ++#endif /* CONFIG_PM_SLEEP */
2038 ++
2039 + static struct platform_driver sh_msiof_spi_drv = {
2040 + .probe = sh_msiof_spi_probe,
2041 + .remove = sh_msiof_spi_remove,
2042 + .id_table = spi_driver_ids,
2043 + .driver = {
2044 + .name = "spi_sh_msiof",
2045 ++ .pm = DEV_PM_OPS,
2046 + .of_match_table = of_match_ptr(sh_msiof_match),
2047 + },
2048 + };
2049 +diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c
2050 +index 85c91f58b42f..af2880d0c112 100644
2051 +--- a/drivers/spi/spi-tegra20-slink.c
2052 ++++ b/drivers/spi/spi-tegra20-slink.c
2053 +@@ -1063,6 +1063,24 @@ static int tegra_slink_probe(struct platform_device *pdev)
2054 + goto exit_free_master;
2055 + }
2056 +
2057 ++ /* disabled clock may cause interrupt storm upon request */
2058 ++ tspi->clk = devm_clk_get(&pdev->dev, NULL);
2059 ++ if (IS_ERR(tspi->clk)) {
2060 ++ ret = PTR_ERR(tspi->clk);
2061 ++ dev_err(&pdev->dev, "Can not get clock %d\n", ret);
2062 ++ goto exit_free_master;
2063 ++ }
2064 ++ ret = clk_prepare(tspi->clk);
2065 ++ if (ret < 0) {
2066 ++ dev_err(&pdev->dev, "Clock prepare failed %d\n", ret);
2067 ++ goto exit_free_master;
2068 ++ }
2069 ++ ret = clk_enable(tspi->clk);
2070 ++ if (ret < 0) {
2071 ++ dev_err(&pdev->dev, "Clock enable failed %d\n", ret);
2072 ++ goto exit_free_master;
2073 ++ }
2074 ++
2075 + spi_irq = platform_get_irq(pdev, 0);
2076 + tspi->irq = spi_irq;
2077 + ret = request_threaded_irq(tspi->irq, tegra_slink_isr,
2078 +@@ -1071,14 +1089,7 @@ static int tegra_slink_probe(struct platform_device *pdev)
2079 + if (ret < 0) {
2080 + dev_err(&pdev->dev, "Failed to register ISR for IRQ %d\n",
2081 + tspi->irq);
2082 +- goto exit_free_master;
2083 +- }
2084 +-
2085 +- tspi->clk = devm_clk_get(&pdev->dev, NULL);
2086 +- if (IS_ERR(tspi->clk)) {
2087 +- dev_err(&pdev->dev, "can not get clock\n");
2088 +- ret = PTR_ERR(tspi->clk);
2089 +- goto exit_free_irq;
2090 ++ goto exit_clk_disable;
2091 + }
2092 +
2093 + tspi->rst = devm_reset_control_get(&pdev->dev, "spi");
2094 +@@ -1138,6 +1149,8 @@ exit_rx_dma_free:
2095 + tegra_slink_deinit_dma_param(tspi, true);
2096 + exit_free_irq:
2097 + free_irq(spi_irq, tspi);
2098 ++exit_clk_disable:
2099 ++ clk_disable(tspi->clk);
2100 + exit_free_master:
2101 + spi_master_put(master);
2102 + return ret;
2103 +@@ -1150,6 +1163,8 @@ static int tegra_slink_remove(struct platform_device *pdev)
2104 +
2105 + free_irq(tspi->irq, tspi);
2106 +
2107 ++ clk_disable(tspi->clk);
2108 ++
2109 + if (tspi->tx_dma_chan)
2110 + tegra_slink_deinit_dma_param(tspi, false);
2111 +
2112 +diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
2113 +index 013b33760639..e9c74c41aece 100644
2114 +--- a/drivers/staging/android/ashmem.c
2115 ++++ b/drivers/staging/android/ashmem.c
2116 +@@ -370,6 +370,12 @@ static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
2117 + goto out;
2118 + }
2119 +
2120 ++ /* requested mapping size larger than object size */
2121 ++ if (vma->vm_end - vma->vm_start > PAGE_ALIGN(asma->size)) {
2122 ++ ret = -EINVAL;
2123 ++ goto out;
2124 ++ }
2125 ++
2126 + /* requested protection bits must match our allowed protection mask */
2127 + if (unlikely((vma->vm_flags & ~calc_vm_prot_bits(asma->prot_mask)) &
2128 + calc_vm_prot_bits(PROT_MASK))) {
2129 +diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c
2130 +index d6c498209b2c..9a876ce92dbd 100644
2131 +--- a/drivers/staging/rts5208/sd.c
2132 ++++ b/drivers/staging/rts5208/sd.c
2133 +@@ -5031,7 +5031,7 @@ int sd_execute_write_data(struct scsi_cmnd *srb, struct rtsx_chip *chip)
2134 + goto SD_Execute_Write_Cmd_Failed;
2135 + }
2136 +
2137 +- rtsx_write_register(chip, SD_BYTE_CNT_L, 0xFF, 0x00);
2138 ++ retval = rtsx_write_register(chip, SD_BYTE_CNT_L, 0xFF, 0x00);
2139 + if (retval != STATUS_SUCCESS) {
2140 + rtsx_trace(chip);
2141 + goto SD_Execute_Write_Cmd_Failed;
2142 +diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c
2143 +index b380bc7ee10a..3184e023a052 100644
2144 +--- a/drivers/target/iscsi/iscsi_target_auth.c
2145 ++++ b/drivers/target/iscsi/iscsi_target_auth.c
2146 +@@ -26,15 +26,6 @@
2147 + #include "iscsi_target_nego.h"
2148 + #include "iscsi_target_auth.h"
2149 +
2150 +-static void chap_binaryhex_to_asciihex(char *dst, char *src, int src_len)
2151 +-{
2152 +- int i;
2153 +-
2154 +- for (i = 0; i < src_len; i++) {
2155 +- sprintf(&dst[i*2], "%02x", (int) src[i] & 0xff);
2156 +- }
2157 +-}
2158 +-
2159 + static void chap_gen_challenge(
2160 + struct iscsi_conn *conn,
2161 + int caller,
2162 +@@ -47,7 +38,7 @@ static void chap_gen_challenge(
2163 + memset(challenge_asciihex, 0, CHAP_CHALLENGE_LENGTH * 2 + 1);
2164 +
2165 + get_random_bytes(chap->challenge, CHAP_CHALLENGE_LENGTH);
2166 +- chap_binaryhex_to_asciihex(challenge_asciihex, chap->challenge,
2167 ++ bin2hex(challenge_asciihex, chap->challenge,
2168 + CHAP_CHALLENGE_LENGTH);
2169 + /*
2170 + * Set CHAP_C, and copy the generated challenge into c_str.
2171 +@@ -287,7 +278,7 @@ static int chap_server_compute_md5(
2172 + }
2173 + crypto_free_hash(tfm);
2174 +
2175 +- chap_binaryhex_to_asciihex(response, server_digest, MD5_SIGNATURE_SIZE);
2176 ++ bin2hex(response, server_digest, MD5_SIGNATURE_SIZE);
2177 + pr_debug("[server] MD5 Server Digest: %s\n", response);
2178 +
2179 + if (memcmp(server_digest, client_digest, MD5_SIGNATURE_SIZE) != 0) {
2180 +@@ -431,7 +422,7 @@ static int chap_server_compute_md5(
2181 + /*
2182 + * Convert response from binary hex to ascii hext.
2183 + */
2184 +- chap_binaryhex_to_asciihex(response, digest, MD5_SIGNATURE_SIZE);
2185 ++ bin2hex(response, digest, MD5_SIGNATURE_SIZE);
2186 + *nr_out_len += sprintf(nr_out_ptr + *nr_out_len, "CHAP_R=0x%s",
2187 + response);
2188 + *nr_out_len += 1;
2189 +diff --git a/drivers/target/iscsi/iscsi_target_tpg.c b/drivers/target/iscsi/iscsi_target_tpg.c
2190 +index 63e1dcc5914d..761b065a40bb 100644
2191 +--- a/drivers/target/iscsi/iscsi_target_tpg.c
2192 ++++ b/drivers/target/iscsi/iscsi_target_tpg.c
2193 +@@ -637,8 +637,7 @@ int iscsit_ta_authentication(struct iscsi_portal_group *tpg, u32 authentication)
2194 + none = strstr(buf1, NONE);
2195 + if (none)
2196 + goto out;
2197 +- strncat(buf1, ",", strlen(","));
2198 +- strncat(buf1, NONE, strlen(NONE));
2199 ++ strlcat(buf1, "," NONE, sizeof(buf1));
2200 + if (iscsi_update_param_value(param, buf1) < 0)
2201 + return -EINVAL;
2202 + }
2203 +diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c
2204 +index be4eedcb839a..236c4eb5cf78 100644
2205 +--- a/drivers/thermal/of-thermal.c
2206 ++++ b/drivers/thermal/of-thermal.c
2207 +@@ -284,10 +284,13 @@ static int of_thermal_set_mode(struct thermal_zone_device *tz,
2208 +
2209 + mutex_lock(&tz->lock);
2210 +
2211 +- if (mode == THERMAL_DEVICE_ENABLED)
2212 ++ if (mode == THERMAL_DEVICE_ENABLED) {
2213 + tz->polling_delay = data->polling_delay;
2214 +- else
2215 ++ tz->passive_delay = data->passive_delay;
2216 ++ } else {
2217 + tz->polling_delay = 0;
2218 ++ tz->passive_delay = 0;
2219 ++ }
2220 +
2221 + mutex_unlock(&tz->lock);
2222 +
2223 +diff --git a/drivers/tty/serial/8250/serial_cs.c b/drivers/tty/serial/8250/serial_cs.c
2224 +index 4d180c9423ef..1a14948c86d6 100644
2225 +--- a/drivers/tty/serial/8250/serial_cs.c
2226 ++++ b/drivers/tty/serial/8250/serial_cs.c
2227 +@@ -629,8 +629,10 @@ static int serial_config(struct pcmcia_device * link)
2228 + (link->has_func_id) &&
2229 + (link->socket->pcmcia_pfc == 0) &&
2230 + ((link->func_id == CISTPL_FUNCID_MULTI) ||
2231 +- (link->func_id == CISTPL_FUNCID_SERIAL)))
2232 +- pcmcia_loop_config(link, serial_check_for_multi, info);
2233 ++ (link->func_id == CISTPL_FUNCID_SERIAL))) {
2234 ++ if (pcmcia_loop_config(link, serial_check_for_multi, info))
2235 ++ goto failed;
2236 ++ }
2237 +
2238 + /*
2239 + * Apply any multi-port quirk.
2240 +diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c
2241 +index d3e3d42c0c12..0040c29f651a 100644
2242 +--- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c
2243 ++++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c
2244 +@@ -1068,8 +1068,8 @@ static int poll_wait_key(char *obuf, struct uart_cpm_port *pinfo)
2245 + /* Get the address of the host memory buffer.
2246 + */
2247 + bdp = pinfo->rx_cur;
2248 +- while (bdp->cbd_sc & BD_SC_EMPTY)
2249 +- ;
2250 ++ if (bdp->cbd_sc & BD_SC_EMPTY)
2251 ++ return NO_POLL_CHAR;
2252 +
2253 + /* If the buffer address is in the CPM DPRAM, don't
2254 + * convert it.
2255 +@@ -1104,7 +1104,11 @@ static int cpm_get_poll_char(struct uart_port *port)
2256 + poll_chars = 0;
2257 + }
2258 + if (poll_chars <= 0) {
2259 +- poll_chars = poll_wait_key(poll_buf, pinfo);
2260 ++ int ret = poll_wait_key(poll_buf, pinfo);
2261 ++
2262 ++ if (ret == NO_POLL_CHAR)
2263 ++ return ret;
2264 ++ poll_chars = ret;
2265 + pollp = poll_buf;
2266 + }
2267 + poll_chars--;
2268 +diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
2269 +index 07ede982b472..f5f46c121ee3 100644
2270 +--- a/drivers/tty/serial/imx.c
2271 ++++ b/drivers/tty/serial/imx.c
2272 +@@ -1997,6 +1997,14 @@ static int serial_imx_probe(struct platform_device *pdev)
2273 + dev_name(&pdev->dev), sport);
2274 + if (ret)
2275 + return ret;
2276 ++
2277 ++ ret = devm_request_irq(&pdev->dev, rtsirq, imx_rtsint, 0,
2278 ++ dev_name(&pdev->dev), sport);
2279 ++ if (ret) {
2280 ++ dev_err(&pdev->dev, "failed to request rts irq: %d\n",
2281 ++ ret);
2282 ++ return ret;
2283 ++ }
2284 + } else {
2285 + ret = devm_request_irq(&pdev->dev, rxirq, imx_int, 0,
2286 + dev_name(&pdev->dev), sport);
2287 +diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
2288 +index 4380e4f600ab..61ea87917433 100644
2289 +--- a/drivers/usb/class/cdc-wdm.c
2290 ++++ b/drivers/usb/class/cdc-wdm.c
2291 +@@ -453,7 +453,7 @@ static int clear_wdm_read_flag(struct wdm_device *desc)
2292 +
2293 + set_bit(WDM_RESPONDING, &desc->flags);
2294 + spin_unlock_irq(&desc->iuspin);
2295 +- rv = usb_submit_urb(desc->response, GFP_ATOMIC);
2296 ++ rv = usb_submit_urb(desc->response, GFP_KERNEL);
2297 + spin_lock_irq(&desc->iuspin);
2298 + if (rv) {
2299 + dev_err(&desc->intf->dev,
2300 +diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
2301 +index ad2e6d235c30..5e0af15aebc4 100644
2302 +--- a/drivers/usb/core/devio.c
2303 ++++ b/drivers/usb/core/devio.c
2304 +@@ -1289,10 +1289,13 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb
2305 + struct async *as = NULL;
2306 + struct usb_ctrlrequest *dr = NULL;
2307 + unsigned int u, totlen, isofrmlen;
2308 +- int i, ret, is_in, num_sgs = 0, ifnum = -1;
2309 ++ int i, ret, num_sgs = 0, ifnum = -1;
2310 + int number_of_packets = 0;
2311 + unsigned int stream_id = 0;
2312 + void *buf;
2313 ++ bool is_in;
2314 ++ bool allow_short = false;
2315 ++ bool allow_zero = false;
2316 + unsigned long mask = USBDEVFS_URB_SHORT_NOT_OK |
2317 + USBDEVFS_URB_BULK_CONTINUATION |
2318 + USBDEVFS_URB_NO_FSBR |
2319 +@@ -1326,6 +1329,8 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb
2320 + u = 0;
2321 + switch (uurb->type) {
2322 + case USBDEVFS_URB_TYPE_CONTROL:
2323 ++ if (is_in)
2324 ++ allow_short = true;
2325 + if (!usb_endpoint_xfer_control(&ep->desc))
2326 + return -EINVAL;
2327 + /* min 8 byte setup packet */
2328 +@@ -1366,6 +1371,10 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb
2329 + break;
2330 +
2331 + case USBDEVFS_URB_TYPE_BULK:
2332 ++ if (!is_in)
2333 ++ allow_zero = true;
2334 ++ else
2335 ++ allow_short = true;
2336 + switch (usb_endpoint_type(&ep->desc)) {
2337 + case USB_ENDPOINT_XFER_CONTROL:
2338 + case USB_ENDPOINT_XFER_ISOC:
2339 +@@ -1386,6 +1395,10 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb
2340 + if (!usb_endpoint_xfer_int(&ep->desc))
2341 + return -EINVAL;
2342 + interrupt_urb:
2343 ++ if (!is_in)
2344 ++ allow_zero = true;
2345 ++ else
2346 ++ allow_short = true;
2347 + break;
2348 +
2349 + case USBDEVFS_URB_TYPE_ISO:
2350 +@@ -1512,16 +1525,21 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb
2351 + u = (is_in ? URB_DIR_IN : URB_DIR_OUT);
2352 + if (uurb->flags & USBDEVFS_URB_ISO_ASAP)
2353 + u |= URB_ISO_ASAP;
2354 +- if (uurb->flags & USBDEVFS_URB_SHORT_NOT_OK && is_in)
2355 ++ if (allow_short && uurb->flags & USBDEVFS_URB_SHORT_NOT_OK)
2356 + u |= URB_SHORT_NOT_OK;
2357 + if (uurb->flags & USBDEVFS_URB_NO_FSBR)
2358 + u |= URB_NO_FSBR;
2359 +- if (uurb->flags & USBDEVFS_URB_ZERO_PACKET)
2360 ++ if (allow_zero && uurb->flags & USBDEVFS_URB_ZERO_PACKET)
2361 + u |= URB_ZERO_PACKET;
2362 + if (uurb->flags & USBDEVFS_URB_NO_INTERRUPT)
2363 + u |= URB_NO_INTERRUPT;
2364 + as->urb->transfer_flags = u;
2365 +
2366 ++ if (!allow_short && uurb->flags & USBDEVFS_URB_SHORT_NOT_OK)
2367 ++ dev_warn(&ps->dev->dev, "Requested nonsensical USBDEVFS_URB_SHORT_NOT_OK.\n");
2368 ++ if (!allow_zero && uurb->flags & USBDEVFS_URB_ZERO_PACKET)
2369 ++ dev_warn(&ps->dev->dev, "Requested nonsensical USBDEVFS_URB_ZERO_PACKET.\n");
2370 ++
2371 + as->urb->transfer_buffer_length = uurb->buffer_length;
2372 + as->urb->setup_packet = (unsigned char *)dr;
2373 + dr = NULL;
2374 +diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
2375 +index 0bb380a9fcf7..e9d6cf146fcc 100644
2376 +--- a/drivers/usb/core/driver.c
2377 ++++ b/drivers/usb/core/driver.c
2378 +@@ -509,7 +509,6 @@ int usb_driver_claim_interface(struct usb_driver *driver,
2379 + struct device *dev;
2380 + struct usb_device *udev;
2381 + int retval = 0;
2382 +- int lpm_disable_error = -ENODEV;
2383 +
2384 + if (!iface)
2385 + return -ENODEV;
2386 +@@ -530,16 +529,6 @@ int usb_driver_claim_interface(struct usb_driver *driver,
2387 +
2388 + iface->condition = USB_INTERFACE_BOUND;
2389 +
2390 +- /* See the comment about disabling LPM in usb_probe_interface(). */
2391 +- if (driver->disable_hub_initiated_lpm) {
2392 +- lpm_disable_error = usb_unlocked_disable_lpm(udev);
2393 +- if (lpm_disable_error) {
2394 +- dev_err(&iface->dev, "%s Failed to disable LPM for driver %s\n.",
2395 +- __func__, driver->name);
2396 +- return -ENOMEM;
2397 +- }
2398 +- }
2399 +-
2400 + /* Claimed interfaces are initially inactive (suspended) and
2401 + * runtime-PM-enabled, but only if the driver has autosuspend
2402 + * support. Otherwise they are marked active, to prevent the
2403 +@@ -558,9 +547,20 @@ int usb_driver_claim_interface(struct usb_driver *driver,
2404 + if (device_is_registered(dev))
2405 + retval = device_bind_driver(dev);
2406 +
2407 +- /* Attempt to re-enable USB3 LPM, if the disable was successful. */
2408 +- if (!lpm_disable_error)
2409 +- usb_unlocked_enable_lpm(udev);
2410 ++ if (retval) {
2411 ++ dev->driver = NULL;
2412 ++ usb_set_intfdata(iface, NULL);
2413 ++ iface->needs_remote_wakeup = 0;
2414 ++ iface->condition = USB_INTERFACE_UNBOUND;
2415 ++
2416 ++ /*
2417 ++ * Unbound interfaces are always runtime-PM-disabled
2418 ++ * and runtime-PM-suspended
2419 ++ */
2420 ++ if (driver->supports_autosuspend)
2421 ++ pm_runtime_disable(dev);
2422 ++ pm_runtime_set_suspended(dev);
2423 ++ }
2424 +
2425 + return retval;
2426 + }
2427 +diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
2428 +index f8bbd0b6d9fe..ad308c8e9af5 100644
2429 +--- a/drivers/usb/core/usb.c
2430 ++++ b/drivers/usb/core/usb.c
2431 +@@ -95,6 +95,8 @@ struct usb_host_interface *usb_find_alt_setting(
2432 + struct usb_interface_cache *intf_cache = NULL;
2433 + int i;
2434 +
2435 ++ if (!config)
2436 ++ return NULL;
2437 + for (i = 0; i < config->desc.bNumInterfaces; i++) {
2438 + if (config->intf_cache[i]->altsetting[0].desc.bInterfaceNumber
2439 + == iface_num) {
2440 +diff --git a/drivers/usb/gadget/udc/fotg210-udc.c b/drivers/usb/gadget/udc/fotg210-udc.c
2441 +index 6ba122cc7490..95df2b3bb6a1 100644
2442 +--- a/drivers/usb/gadget/udc/fotg210-udc.c
2443 ++++ b/drivers/usb/gadget/udc/fotg210-udc.c
2444 +@@ -1066,12 +1066,15 @@ static struct usb_gadget_ops fotg210_gadget_ops = {
2445 + static int fotg210_udc_remove(struct platform_device *pdev)
2446 + {
2447 + struct fotg210_udc *fotg210 = platform_get_drvdata(pdev);
2448 ++ int i;
2449 +
2450 + usb_del_gadget_udc(&fotg210->gadget);
2451 + iounmap(fotg210->reg);
2452 + free_irq(platform_get_irq(pdev, 0), fotg210);
2453 +
2454 + fotg210_ep_free_request(&fotg210->ep[0]->ep, fotg210->ep0_req);
2455 ++ for (i = 0; i < FOTG210_MAX_NUM_EP; i++)
2456 ++ kfree(fotg210->ep[i]);
2457 + kfree(fotg210);
2458 +
2459 + return 0;
2460 +@@ -1102,7 +1105,7 @@ static int fotg210_udc_probe(struct platform_device *pdev)
2461 + /* initialize udc */
2462 + fotg210 = kzalloc(sizeof(struct fotg210_udc), GFP_KERNEL);
2463 + if (fotg210 == NULL)
2464 +- goto err_alloc;
2465 ++ goto err;
2466 +
2467 + for (i = 0; i < FOTG210_MAX_NUM_EP; i++) {
2468 + _ep[i] = kzalloc(sizeof(struct fotg210_ep), GFP_KERNEL);
2469 +@@ -1114,7 +1117,7 @@ static int fotg210_udc_probe(struct platform_device *pdev)
2470 + fotg210->reg = ioremap(res->start, resource_size(res));
2471 + if (fotg210->reg == NULL) {
2472 + pr_err("ioremap error.\n");
2473 +- goto err_map;
2474 ++ goto err_alloc;
2475 + }
2476 +
2477 + spin_lock_init(&fotg210->lock);
2478 +@@ -1162,7 +1165,7 @@ static int fotg210_udc_probe(struct platform_device *pdev)
2479 + fotg210->ep0_req = fotg210_ep_alloc_request(&fotg210->ep[0]->ep,
2480 + GFP_KERNEL);
2481 + if (fotg210->ep0_req == NULL)
2482 +- goto err_req;
2483 ++ goto err_map;
2484 +
2485 + fotg210_init(fotg210);
2486 +
2487 +@@ -1190,12 +1193,14 @@ err_req:
2488 + fotg210_ep_free_request(&fotg210->ep[0]->ep, fotg210->ep0_req);
2489 +
2490 + err_map:
2491 +- if (fotg210->reg)
2492 +- iounmap(fotg210->reg);
2493 ++ iounmap(fotg210->reg);
2494 +
2495 + err_alloc:
2496 ++ for (i = 0; i < FOTG210_MAX_NUM_EP; i++)
2497 ++ kfree(fotg210->ep[i]);
2498 + kfree(fotg210);
2499 +
2500 ++err:
2501 + return ret;
2502 + }
2503 +
2504 +diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c
2505 +index e8e8702d5adf..5594a4a4a83f 100644
2506 +--- a/drivers/usb/misc/yurex.c
2507 ++++ b/drivers/usb/misc/yurex.c
2508 +@@ -431,6 +431,9 @@ static ssize_t yurex_read(struct file *file, char __user *buffer, size_t count,
2509 + spin_unlock_irqrestore(&dev->lock, flags);
2510 + mutex_unlock(&dev->io_mutex);
2511 +
2512 ++ if (WARN_ON_ONCE(len >= sizeof(in_buffer)))
2513 ++ return -EIO;
2514 ++
2515 + return simple_read_from_buffer(buffer, count, ppos, in_buffer, len);
2516 + }
2517 +
2518 +diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c
2519 +index 813035f51fe7..7d252678c55a 100644
2520 +--- a/drivers/usb/serial/kobil_sct.c
2521 ++++ b/drivers/usb/serial/kobil_sct.c
2522 +@@ -408,12 +408,20 @@ static int kobil_tiocmget(struct tty_struct *tty)
2523 + transfer_buffer_length,
2524 + KOBIL_TIMEOUT);
2525 +
2526 +- dev_dbg(&port->dev, "%s - Send get_status_line_state URB returns: %i. Statusline: %02x\n",
2527 +- __func__, result, transfer_buffer[0]);
2528 ++ dev_dbg(&port->dev, "Send get_status_line_state URB returns: %i\n",
2529 ++ result);
2530 ++ if (result < 1) {
2531 ++ if (result >= 0)
2532 ++ result = -EIO;
2533 ++ goto out_free;
2534 ++ }
2535 ++
2536 ++ dev_dbg(&port->dev, "Statusline: %02x\n", transfer_buffer[0]);
2537 +
2538 + result = 0;
2539 + if ((transfer_buffer[0] & SUSBCR_GSL_DSR) != 0)
2540 + result = TIOCM_DSR;
2541 ++out_free:
2542 + kfree(transfer_buffer);
2543 + return result;
2544 + }
2545 +diff --git a/drivers/usb/wusbcore/security.c b/drivers/usb/wusbcore/security.c
2546 +index b66faaf3e842..4019c11f24e2 100644
2547 +--- a/drivers/usb/wusbcore/security.c
2548 ++++ b/drivers/usb/wusbcore/security.c
2549 +@@ -230,7 +230,7 @@ int wusb_dev_sec_add(struct wusbhc *wusbhc,
2550 +
2551 + result = usb_get_descriptor(usb_dev, USB_DT_SECURITY,
2552 + 0, secd, sizeof(*secd));
2553 +- if (result < sizeof(*secd)) {
2554 ++ if (result < (int)sizeof(*secd)) {
2555 + dev_err(dev, "Can't read security descriptor or "
2556 + "not enough data: %d\n", result);
2557 + goto out;
2558 +diff --git a/drivers/uwb/hwa-rc.c b/drivers/uwb/hwa-rc.c
2559 +index 1212b4b3c5a9..e9ff710a3d12 100644
2560 +--- a/drivers/uwb/hwa-rc.c
2561 ++++ b/drivers/uwb/hwa-rc.c
2562 +@@ -875,6 +875,7 @@ error_get_version:
2563 + error_rc_add:
2564 + usb_put_intf(iface);
2565 + usb_put_dev(hwarc->usb_dev);
2566 ++ kfree(hwarc);
2567 + error_alloc:
2568 + uwb_rc_put(uwb_rc);
2569 + error_rc_alloc:
2570 +diff --git a/drivers/xen/cpu_hotplug.c b/drivers/xen/cpu_hotplug.c
2571 +index 5676aefdf2bc..f4e59c445964 100644
2572 +--- a/drivers/xen/cpu_hotplug.c
2573 ++++ b/drivers/xen/cpu_hotplug.c
2574 +@@ -18,15 +18,16 @@ static void enable_hotplug_cpu(int cpu)
2575 +
2576 + static void disable_hotplug_cpu(int cpu)
2577 + {
2578 +- if (cpu_online(cpu)) {
2579 +- lock_device_hotplug();
2580 ++ if (!cpu_is_hotpluggable(cpu))
2581 ++ return;
2582 ++ lock_device_hotplug();
2583 ++ if (cpu_online(cpu))
2584 + device_offline(get_cpu_device(cpu));
2585 +- unlock_device_hotplug();
2586 +- }
2587 +- if (cpu_present(cpu))
2588 ++ if (!cpu_online(cpu) && cpu_present(cpu)) {
2589 + xen_arch_unregister_cpu(cpu);
2590 +-
2591 +- set_cpu_present(cpu, false);
2592 ++ set_cpu_present(cpu, false);
2593 ++ }
2594 ++ unlock_device_hotplug();
2595 + }
2596 +
2597 + static int vcpu_online(unsigned int cpu)
2598 +diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
2599 +index 21d679f88dfa..878a40950a3a 100644
2600 +--- a/drivers/xen/events/events_base.c
2601 ++++ b/drivers/xen/events/events_base.c
2602 +@@ -139,7 +139,7 @@ static int set_evtchn_to_irq(unsigned evtchn, unsigned irq)
2603 + clear_evtchn_to_irq_row(row);
2604 + }
2605 +
2606 +- evtchn_to_irq[EVTCHN_ROW(evtchn)][EVTCHN_COL(evtchn)] = irq;
2607 ++ evtchn_to_irq[row][col] = irq;
2608 + return 0;
2609 + }
2610 +
2611 +diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c
2612 +index 2dd285827169..f494126aaecd 100644
2613 +--- a/drivers/xen/manage.c
2614 ++++ b/drivers/xen/manage.c
2615 +@@ -280,9 +280,11 @@ static void sysrq_handler(struct xenbus_watch *watch, const char **vec,
2616 + /*
2617 + * The Xenstore watch fires directly after registering it and
2618 + * after a suspend/resume cycle. So ENOENT is no error but
2619 +- * might happen in those cases.
2620 ++ * might happen in those cases. ERANGE is observed when we get
2621 ++ * an empty value (''), this happens when we acknowledge the
2622 ++ * request by writing '\0' below.
2623 + */
2624 +- if (err != -ENOENT)
2625 ++ if (err != -ENOENT && err != -ERANGE)
2626 + pr_err("Error %d reading sysrq code in control/sysrq\n",
2627 + err);
2628 + xenbus_transaction_end(xbt, 1);
2629 +diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c
2630 +index a0b3e7d1be48..211ac472cb9d 100644
2631 +--- a/fs/cifs/cifs_unicode.c
2632 ++++ b/fs/cifs/cifs_unicode.c
2633 +@@ -101,9 +101,6 @@ convert_sfm_char(const __u16 src_char, char *target)
2634 + case SFM_LESSTHAN:
2635 + *target = '<';
2636 + break;
2637 +- case SFM_SLASH:
2638 +- *target = '\\';
2639 +- break;
2640 + case SFM_SPACE:
2641 + *target = ' ';
2642 + break;
2643 +diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
2644 +index 63aea21e6298..b9b8f19dce0e 100644
2645 +--- a/fs/cifs/cifssmb.c
2646 ++++ b/fs/cifs/cifssmb.c
2647 +@@ -577,10 +577,15 @@ CIFSSMBNegotiate(const unsigned int xid, struct cifs_ses *ses)
2648 + }
2649 +
2650 + count = 0;
2651 ++ /*
2652 ++ * We know that all the name entries in the protocols array
2653 ++ * are short (< 16 bytes anyway) and are NUL terminated.
2654 ++ */
2655 + for (i = 0; i < CIFS_NUM_PROT; i++) {
2656 +- strncpy(pSMB->DialectsArray+count, protocols[i].name, 16);
2657 +- count += strlen(protocols[i].name) + 1;
2658 +- /* null at end of source and target buffers anyway */
2659 ++ size_t len = strlen(protocols[i].name) + 1;
2660 ++
2661 ++ memcpy(pSMB->DialectsArray+count, protocols[i].name, len);
2662 ++ count += len;
2663 + }
2664 + inc_rfc1001_len(pSMB, count);
2665 + pSMB->ByteCount = cpu_to_le16(count);
2666 +diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
2667 +index 0cc699d9b932..61a09ab2752e 100644
2668 +--- a/fs/cifs/misc.c
2669 ++++ b/fs/cifs/misc.c
2670 +@@ -406,9 +406,17 @@ is_valid_oplock_break(char *buffer, struct TCP_Server_Info *srv)
2671 + (struct smb_com_transaction_change_notify_rsp *)buf;
2672 + struct file_notify_information *pnotify;
2673 + __u32 data_offset = 0;
2674 ++ size_t len = srv->total_read - sizeof(pSMBr->hdr.smb_buf_length);
2675 ++
2676 + if (get_bcc(buf) > sizeof(struct file_notify_information)) {
2677 + data_offset = le32_to_cpu(pSMBr->DataOffset);
2678 +
2679 ++ if (data_offset >
2680 ++ len - sizeof(struct file_notify_information)) {
2681 ++ cifs_dbg(FYI, "invalid data_offset %u\n",
2682 ++ data_offset);
2683 ++ return true;
2684 ++ }
2685 + pnotify = (struct file_notify_information *)
2686 + ((char *)&pSMBr->hdr.Protocol + data_offset);
2687 + cifs_dbg(FYI, "dnotify on %s Action: 0x%x\n",
2688 +diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
2689 +index e6b1795fbf2a..2725085a3f9f 100644
2690 +--- a/fs/cifs/smb2ops.c
2691 ++++ b/fs/cifs/smb2ops.c
2692 +@@ -914,7 +914,7 @@ smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon,
2693 + }
2694 +
2695 + srch_inf->entries_in_buffer = 0;
2696 +- srch_inf->index_of_last_entry = 0;
2697 ++ srch_inf->index_of_last_entry = 2;
2698 +
2699 + rc = SMB2_query_directory(xid, tcon, fid->persistent_fid,
2700 + fid->volatile_fid, 0, srch_inf);
2701 +diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
2702 +index 9fb2a751fce4..b51bb73b06a6 100644
2703 +--- a/fs/ext4/xattr.c
2704 ++++ b/fs/ext4/xattr.c
2705 +@@ -1386,6 +1386,11 @@ retry:
2706 + /* Find the entry best suited to be pushed into EA block */
2707 + entry = NULL;
2708 + for (; !IS_LAST_ENTRY(last); last = EXT4_XATTR_NEXT(last)) {
2709 ++ /* never move system.data out of the inode */
2710 ++ if ((last->e_name_len == 4) &&
2711 ++ (last->e_name_index == EXT4_XATTR_INDEX_SYSTEM) &&
2712 ++ !memcmp(last->e_name, "data", 4))
2713 ++ continue;
2714 + total_size =
2715 + EXT4_XATTR_SIZE(le32_to_cpu(last->e_value_size)) +
2716 + EXT4_XATTR_LEN(last->e_name_len);
2717 +diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
2718 +index bfbee8ddf978..c67064d94096 100644
2719 +--- a/fs/nfsd/nfs4proc.c
2720 ++++ b/fs/nfsd/nfs4proc.c
2721 +@@ -1632,6 +1632,7 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
2722 + if (status) {
2723 + op = &args->ops[0];
2724 + op->status = status;
2725 ++ resp->opcnt = 1;
2726 + goto encode_op;
2727 + }
2728 +
2729 +diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
2730 +index 4e2162b355db..0cefb036a17e 100644
2731 +--- a/fs/ocfs2/dlm/dlmmaster.c
2732 ++++ b/fs/ocfs2/dlm/dlmmaster.c
2733 +@@ -589,9 +589,9 @@ static void dlm_init_lockres(struct dlm_ctxt *dlm,
2734 +
2735 + res->last_used = 0;
2736 +
2737 +- spin_lock(&dlm->spinlock);
2738 ++ spin_lock(&dlm->track_lock);
2739 + list_add_tail(&res->tracking, &dlm->tracking_list);
2740 +- spin_unlock(&dlm->spinlock);
2741 ++ spin_unlock(&dlm->track_lock);
2742 +
2743 + memset(res->lvb, 0, DLM_LVB_LEN);
2744 + memset(res->refmap, 0, sizeof(res->refmap));
2745 +diff --git a/fs/proc/base.c b/fs/proc/base.c
2746 +index 5f9cec2db6c3..4beed301e224 100644
2747 +--- a/fs/proc/base.c
2748 ++++ b/fs/proc/base.c
2749 +@@ -471,6 +471,20 @@ static int proc_pid_stack(struct seq_file *m, struct pid_namespace *ns,
2750 + int err;
2751 + int i;
2752 +
2753 ++ /*
2754 ++ * The ability to racily run the kernel stack unwinder on a running task
2755 ++ * and then observe the unwinder output is scary; while it is useful for
2756 ++ * debugging kernel issues, it can also allow an attacker to leak kernel
2757 ++ * stack contents.
2758 ++ * Doing this in a manner that is at least safe from races would require
2759 ++ * some work to ensure that the remote task can not be scheduled; and
2760 ++ * even then, this would still expose the unwinder as local attack
2761 ++ * surface.
2762 ++ * Therefore, this interface is restricted to root.
2763 ++ */
2764 ++ if (!file_ns_capable(m->file, &init_user_ns, CAP_SYS_ADMIN))
2765 ++ return -EACCES;
2766 ++
2767 + entries = kmalloc(MAX_STACK_TRACE_DEPTH * sizeof(*entries), GFP_KERNEL);
2768 + if (!entries)
2769 + return -ENOMEM;
2770 +diff --git a/include/linux/platform_data/ina2xx.h b/include/linux/platform_data/ina2xx.h
2771 +index 9abc0ca7259b..9f0aa1b48c78 100644
2772 +--- a/include/linux/platform_data/ina2xx.h
2773 ++++ b/include/linux/platform_data/ina2xx.h
2774 +@@ -1,7 +1,7 @@
2775 + /*
2776 + * Driver for Texas Instruments INA219, INA226 power monitor chips
2777 + *
2778 +- * Copyright (C) 2012 Lothar Felten <l-felten@××.com>
2779 ++ * Copyright (C) 2012 Lothar Felten <lothar.felten@×××××.com>
2780 + *
2781 + * This program is free software; you can redistribute it and/or modify
2782 + * it under the terms of the GNU General Public License version 2 as
2783 +diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
2784 +index 33885118523c..9b681f21c2a9 100644
2785 +--- a/include/linux/slub_def.h
2786 ++++ b/include/linux/slub_def.h
2787 +@@ -67,7 +67,8 @@ struct kmem_cache {
2788 + int size; /* The size of an object including meta data */
2789 + int object_size; /* The size of an object without meta data */
2790 + int offset; /* Free pointer offset. */
2791 +- int cpu_partial; /* Number of per cpu partial objects to keep around */
2792 ++ /* Number of per cpu partial objects to keep around */
2793 ++ unsigned int cpu_partial;
2794 + struct kmem_cache_order_objects oo;
2795 +
2796 + /* Allocation and freeing of slabs */
2797 +diff --git a/include/media/v4l2-fh.h b/include/media/v4l2-fh.h
2798 +index 803516775162..4fdcd0d807d7 100644
2799 +--- a/include/media/v4l2-fh.h
2800 ++++ b/include/media/v4l2-fh.h
2801 +@@ -43,6 +43,7 @@ struct v4l2_fh {
2802 + wait_queue_head_t wait;
2803 + struct list_head subscribed; /* Subscribed events */
2804 + struct list_head available; /* Dequeueable event */
2805 ++ struct mutex subscribe_lock;
2806 + unsigned int navailable;
2807 + u32 sequence;
2808 +
2809 +diff --git a/kernel/module.c b/kernel/module.c
2810 +index aa81f41f2b19..bcc78f4c15e9 100644
2811 +--- a/kernel/module.c
2812 ++++ b/kernel/module.c
2813 +@@ -3860,7 +3860,7 @@ static unsigned long mod_find_symname(struct module *mod, const char *name)
2814 +
2815 + for (i = 0; i < kallsyms->num_symtab; i++)
2816 + if (strcmp(name, symname(kallsyms, i)) == 0 &&
2817 +- kallsyms->symtab[i].st_info != 'U')
2818 ++ kallsyms->symtab[i].st_shndx != SHN_UNDEF)
2819 + return kallsyms->symtab[i].st_value;
2820 + return 0;
2821 + }
2822 +@@ -3906,6 +3906,10 @@ int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
2823 + if (mod->state == MODULE_STATE_UNFORMED)
2824 + continue;
2825 + for (i = 0; i < kallsyms->num_symtab; i++) {
2826 ++
2827 ++ if (kallsyms->symtab[i].st_shndx == SHN_UNDEF)
2828 ++ continue;
2829 ++
2830 + ret = fn(data, symname(kallsyms, i),
2831 + mod, kallsyms->symtab[i].st_value);
2832 + if (ret != 0)
2833 +diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
2834 +index 6fcc367ad531..e78480b81f8d 100644
2835 +--- a/kernel/time/alarmtimer.c
2836 ++++ b/kernel/time/alarmtimer.c
2837 +@@ -773,7 +773,8 @@ static int alarm_timer_nsleep(const clockid_t which_clock, int flags,
2838 + /* Convert (if necessary) to absolute time */
2839 + if (flags != TIMER_ABSTIME) {
2840 + ktime_t now = alarm_bases[type].gettime();
2841 +- exp = ktime_add(now, exp);
2842 ++
2843 ++ exp = ktime_add_safe(now, exp);
2844 + }
2845 +
2846 + if (alarmtimer_do_nsleep(&alarm, exp))
2847 +diff --git a/lib/klist.c b/lib/klist.c
2848 +index 0507fa5d84c5..f6b547812fe3 100644
2849 +--- a/lib/klist.c
2850 ++++ b/lib/klist.c
2851 +@@ -336,8 +336,9 @@ struct klist_node *klist_prev(struct klist_iter *i)
2852 + void (*put)(struct klist_node *) = i->i_klist->put;
2853 + struct klist_node *last = i->i_cur;
2854 + struct klist_node *prev;
2855 ++ unsigned long flags;
2856 +
2857 +- spin_lock(&i->i_klist->k_lock);
2858 ++ spin_lock_irqsave(&i->i_klist->k_lock, flags);
2859 +
2860 + if (last) {
2861 + prev = to_klist_node(last->n_node.prev);
2862 +@@ -356,7 +357,7 @@ struct klist_node *klist_prev(struct klist_iter *i)
2863 + prev = to_klist_node(prev->n_node.prev);
2864 + }
2865 +
2866 +- spin_unlock(&i->i_klist->k_lock);
2867 ++ spin_unlock_irqrestore(&i->i_klist->k_lock, flags);
2868 +
2869 + if (put && last)
2870 + put(last);
2871 +@@ -377,8 +378,9 @@ struct klist_node *klist_next(struct klist_iter *i)
2872 + void (*put)(struct klist_node *) = i->i_klist->put;
2873 + struct klist_node *last = i->i_cur;
2874 + struct klist_node *next;
2875 ++ unsigned long flags;
2876 +
2877 +- spin_lock(&i->i_klist->k_lock);
2878 ++ spin_lock_irqsave(&i->i_klist->k_lock, flags);
2879 +
2880 + if (last) {
2881 + next = to_klist_node(last->n_node.next);
2882 +@@ -397,7 +399,7 @@ struct klist_node *klist_next(struct klist_iter *i)
2883 + next = to_klist_node(next->n_node.next);
2884 + }
2885 +
2886 +- spin_unlock(&i->i_klist->k_lock);
2887 ++ spin_unlock_irqrestore(&i->i_klist->k_lock, flags);
2888 +
2889 + if (put && last)
2890 + put(last);
2891 +diff --git a/mm/madvise.c b/mm/madvise.c
2892 +index 2a0f9a4504f1..f548c66154ee 100644
2893 +--- a/mm/madvise.c
2894 ++++ b/mm/madvise.c
2895 +@@ -76,7 +76,7 @@ static long madvise_behavior(struct vm_area_struct *vma,
2896 + new_flags |= VM_DONTDUMP;
2897 + break;
2898 + case MADV_DODUMP:
2899 +- if (new_flags & VM_SPECIAL) {
2900 ++ if (!is_vm_hugetlb_page(vma) && new_flags & VM_SPECIAL) {
2901 + error = -EINVAL;
2902 + goto out;
2903 + }
2904 +diff --git a/mm/slub.c b/mm/slub.c
2905 +index 2284c4333857..c33b0e13cca7 100644
2906 +--- a/mm/slub.c
2907 ++++ b/mm/slub.c
2908 +@@ -1661,7 +1661,7 @@ static void *get_partial_node(struct kmem_cache *s, struct kmem_cache_node *n,
2909 + {
2910 + struct page *page, *page2;
2911 + void *object = NULL;
2912 +- int available = 0;
2913 ++ unsigned int available = 0;
2914 + int objects;
2915 +
2916 + /*
2917 +@@ -4674,10 +4674,10 @@ static ssize_t cpu_partial_show(struct kmem_cache *s, char *buf)
2918 + static ssize_t cpu_partial_store(struct kmem_cache *s, const char *buf,
2919 + size_t length)
2920 + {
2921 +- unsigned long objects;
2922 ++ unsigned int objects;
2923 + int err;
2924 +
2925 +- err = kstrtoul(buf, 10, &objects);
2926 ++ err = kstrtouint(buf, 10, &objects);
2927 + if (err)
2928 + return err;
2929 + if (objects && !kmem_cache_has_cpu_partial(s))
2930 +diff --git a/net/6lowpan/iphc.c b/net/6lowpan/iphc.c
2931 +index 346b5c1a9185..c40eb04dd856 100644
2932 +--- a/net/6lowpan/iphc.c
2933 ++++ b/net/6lowpan/iphc.c
2934 +@@ -569,6 +569,7 @@ int lowpan_header_decompress(struct sk_buff *skb, const struct net_device *dev,
2935 + hdr.hop_limit, &hdr.daddr);
2936 +
2937 + skb_push(skb, sizeof(hdr));
2938 ++ skb_reset_mac_header(skb);
2939 + skb_reset_network_header(skb);
2940 + skb_copy_to_linear_data(skb, &hdr, sizeof(hdr));
2941 +
2942 +diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
2943 +index 24ba31601fc9..f2af19673b26 100644
2944 +--- a/net/mac80211/ibss.c
2945 ++++ b/net/mac80211/ibss.c
2946 +@@ -948,8 +948,8 @@ static void ieee80211_rx_mgmt_deauth_ibss(struct ieee80211_sub_if_data *sdata,
2947 + if (len < IEEE80211_DEAUTH_FRAME_LEN)
2948 + return;
2949 +
2950 +- ibss_dbg(sdata, "RX DeAuth SA=%pM DA=%pM BSSID=%pM (reason: %d)\n",
2951 +- mgmt->sa, mgmt->da, mgmt->bssid, reason);
2952 ++ ibss_dbg(sdata, "RX DeAuth SA=%pM DA=%pM\n", mgmt->sa, mgmt->da);
2953 ++ ibss_dbg(sdata, "\tBSSID=%pM (reason: %d)\n", mgmt->bssid, reason);
2954 + sta_info_destroy_addr(sdata, mgmt->sa);
2955 + }
2956 +
2957 +@@ -967,9 +967,9 @@ static void ieee80211_rx_mgmt_auth_ibss(struct ieee80211_sub_if_data *sdata,
2958 + auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg);
2959 + auth_transaction = le16_to_cpu(mgmt->u.auth.auth_transaction);
2960 +
2961 +- ibss_dbg(sdata,
2962 +- "RX Auth SA=%pM DA=%pM BSSID=%pM (auth_transaction=%d)\n",
2963 +- mgmt->sa, mgmt->da, mgmt->bssid, auth_transaction);
2964 ++ ibss_dbg(sdata, "RX Auth SA=%pM DA=%pM\n", mgmt->sa, mgmt->da);
2965 ++ ibss_dbg(sdata, "\tBSSID=%pM (auth_transaction=%d)\n",
2966 ++ mgmt->bssid, auth_transaction);
2967 +
2968 + if (auth_alg != WLAN_AUTH_OPEN || auth_transaction != 1)
2969 + return;
2970 +@@ -1174,10 +1174,10 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
2971 + rx_timestamp = drv_get_tsf(local, sdata);
2972 + }
2973 +
2974 +- ibss_dbg(sdata,
2975 +- "RX beacon SA=%pM BSSID=%pM TSF=0x%llx BCN=0x%llx diff=%lld @%lu\n",
2976 ++ ibss_dbg(sdata, "RX beacon SA=%pM BSSID=%pM TSF=0x%llx\n",
2977 + mgmt->sa, mgmt->bssid,
2978 +- (unsigned long long)rx_timestamp,
2979 ++ (unsigned long long)rx_timestamp);
2980 ++ ibss_dbg(sdata, "\tBCN=0x%llx diff=%lld @%lu\n",
2981 + (unsigned long long)beacon_timestamp,
2982 + (unsigned long long)(rx_timestamp - beacon_timestamp),
2983 + jiffies);
2984 +@@ -1536,9 +1536,9 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
2985 +
2986 + tx_last_beacon = drv_tx_last_beacon(local);
2987 +
2988 +- ibss_dbg(sdata,
2989 +- "RX ProbeReq SA=%pM DA=%pM BSSID=%pM (tx_last_beacon=%d)\n",
2990 +- mgmt->sa, mgmt->da, mgmt->bssid, tx_last_beacon);
2991 ++ ibss_dbg(sdata, "RX ProbeReq SA=%pM DA=%pM\n", mgmt->sa, mgmt->da);
2992 ++ ibss_dbg(sdata, "\tBSSID=%pM (tx_last_beacon=%d)\n",
2993 ++ mgmt->bssid, tx_last_beacon);
2994 +
2995 + if (!tx_last_beacon && is_multicast_ether_addr(mgmt->da))
2996 + return;
2997 +diff --git a/net/mac80211/main.c b/net/mac80211/main.c
2998 +index 2ee53dc1ddf7..15d23aeea634 100644
2999 +--- a/net/mac80211/main.c
3000 ++++ b/net/mac80211/main.c
3001 +@@ -253,8 +253,27 @@ static void ieee80211_restart_work(struct work_struct *work)
3002 + "%s called with hardware scan in progress\n", __func__);
3003 +
3004 + rtnl_lock();
3005 +- list_for_each_entry(sdata, &local->interfaces, list)
3006 ++ list_for_each_entry(sdata, &local->interfaces, list) {
3007 ++ /*
3008 ++ * XXX: there may be more work for other vif types and even
3009 ++ * for station mode: a good thing would be to run most of
3010 ++ * the iface type's dependent _stop (ieee80211_mg_stop,
3011 ++ * ieee80211_ibss_stop) etc...
3012 ++ * For now, fix only the specific bug that was seen: race
3013 ++ * between csa_connection_drop_work and us.
3014 ++ */
3015 ++ if (sdata->vif.type == NL80211_IFTYPE_STATION) {
3016 ++ /*
3017 ++ * This worker is scheduled from the iface worker that
3018 ++ * runs on mac80211's workqueue, so we can't be
3019 ++ * scheduling this worker after the cancel right here.
3020 ++ * The exception is ieee80211_chswitch_done.
3021 ++ * Then we can have a race...
3022 ++ */
3023 ++ cancel_work_sync(&sdata->u.mgd.csa_connection_drop_work);
3024 ++ }
3025 + flush_delayed_work(&sdata->dec_tailroom_needed_wk);
3026 ++ }
3027 + ieee80211_scan_cancel(local);
3028 + ieee80211_reconfig(local);
3029 + rtnl_unlock();
3030 +@@ -460,10 +479,7 @@ static const struct ieee80211_vht_cap mac80211_vht_capa_mod_mask = {
3031 + cpu_to_le32(IEEE80211_VHT_CAP_RXLDPC |
3032 + IEEE80211_VHT_CAP_SHORT_GI_80 |
3033 + IEEE80211_VHT_CAP_SHORT_GI_160 |
3034 +- IEEE80211_VHT_CAP_RXSTBC_1 |
3035 +- IEEE80211_VHT_CAP_RXSTBC_2 |
3036 +- IEEE80211_VHT_CAP_RXSTBC_3 |
3037 +- IEEE80211_VHT_CAP_RXSTBC_4 |
3038 ++ IEEE80211_VHT_CAP_RXSTBC_MASK |
3039 + IEEE80211_VHT_CAP_TXSTBC |
3040 + IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE |
3041 + IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE |
3042 +diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
3043 +index e68a409fc351..33d5271a9e32 100644
3044 +--- a/net/mac80211/mesh_hwmp.c
3045 ++++ b/net/mac80211/mesh_hwmp.c
3046 +@@ -552,6 +552,10 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata,
3047 + forward = false;
3048 + reply = true;
3049 + target_metric = 0;
3050 ++
3051 ++ if (SN_GT(target_sn, ifmsh->sn))
3052 ++ ifmsh->sn = target_sn;
3053 ++
3054 + if (time_after(jiffies, ifmsh->last_sn_update +
3055 + net_traversal_jiffies(sdata)) ||
3056 + time_before(jiffies, ifmsh->last_sn_update)) {
3057 +diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
3058 +index 005cd8796505..a5e11280f405 100644
3059 +--- a/net/mac80211/mlme.c
3060 ++++ b/net/mac80211/mlme.c
3061 +@@ -1021,6 +1021,10 @@ static void ieee80211_chswitch_work(struct work_struct *work)
3062 + */
3063 +
3064 + if (sdata->reserved_chanctx) {
3065 ++ struct ieee80211_supported_band *sband = NULL;
3066 ++ struct sta_info *mgd_sta = NULL;
3067 ++ enum ieee80211_sta_rx_bandwidth bw = IEEE80211_STA_RX_BW_20;
3068 ++
3069 + /*
3070 + * with multi-vif csa driver may call ieee80211_csa_finish()
3071 + * many times while waiting for other interfaces to use their
3072 +@@ -1029,6 +1033,48 @@ static void ieee80211_chswitch_work(struct work_struct *work)
3073 + if (sdata->reserved_ready)
3074 + goto out;
3075 +
3076 ++ if (sdata->vif.bss_conf.chandef.width !=
3077 ++ sdata->csa_chandef.width) {
3078 ++ /*
3079 ++ * For managed interface, we need to also update the AP
3080 ++ * station bandwidth and align the rate scale algorithm
3081 ++ * on the bandwidth change. Here we only consider the
3082 ++ * bandwidth of the new channel definition (as channel
3083 ++ * switch flow does not have the full HT/VHT/HE
3084 ++ * information), assuming that if additional changes are
3085 ++ * required they would be done as part of the processing
3086 ++ * of the next beacon from the AP.
3087 ++ */
3088 ++ switch (sdata->csa_chandef.width) {
3089 ++ case NL80211_CHAN_WIDTH_20_NOHT:
3090 ++ case NL80211_CHAN_WIDTH_20:
3091 ++ default:
3092 ++ bw = IEEE80211_STA_RX_BW_20;
3093 ++ break;
3094 ++ case NL80211_CHAN_WIDTH_40:
3095 ++ bw = IEEE80211_STA_RX_BW_40;
3096 ++ break;
3097 ++ case NL80211_CHAN_WIDTH_80:
3098 ++ bw = IEEE80211_STA_RX_BW_80;
3099 ++ break;
3100 ++ case NL80211_CHAN_WIDTH_80P80:
3101 ++ case NL80211_CHAN_WIDTH_160:
3102 ++ bw = IEEE80211_STA_RX_BW_160;
3103 ++ break;
3104 ++ }
3105 ++
3106 ++ mgd_sta = sta_info_get(sdata, ifmgd->bssid);
3107 ++ sband =
3108 ++ local->hw.wiphy->bands[sdata->csa_chandef.chan->band];
3109 ++ }
3110 ++
3111 ++ if (sdata->vif.bss_conf.chandef.width >
3112 ++ sdata->csa_chandef.width) {
3113 ++ mgd_sta->sta.bandwidth = bw;
3114 ++ rate_control_rate_update(local, sband, mgd_sta,
3115 ++ IEEE80211_RC_BW_CHANGED);
3116 ++ }
3117 ++
3118 + ret = ieee80211_vif_use_reserved_context(sdata);
3119 + if (ret) {
3120 + sdata_info(sdata,
3121 +@@ -1039,6 +1085,13 @@ static void ieee80211_chswitch_work(struct work_struct *work)
3122 + goto out;
3123 + }
3124 +
3125 ++ if (sdata->vif.bss_conf.chandef.width <
3126 ++ sdata->csa_chandef.width) {
3127 ++ mgd_sta->sta.bandwidth = bw;
3128 ++ rate_control_rate_update(local, sband, mgd_sta,
3129 ++ IEEE80211_RC_BW_CHANGED);
3130 ++ }
3131 ++
3132 + goto out;
3133 + }
3134 +
3135 +diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
3136 +index b07fd8b8b50c..642a78079ae1 100644
3137 +--- a/net/wireless/nl80211.c
3138 ++++ b/net/wireless/nl80211.c
3139 +@@ -10014,6 +10014,7 @@ static int nl80211_update_ft_ies(struct sk_buff *skb, struct genl_info *info)
3140 + return -EOPNOTSUPP;
3141 +
3142 + if (!info->attrs[NL80211_ATTR_MDID] ||
3143 ++ !info->attrs[NL80211_ATTR_IE] ||
3144 + !is_valid_ie_attr(info->attrs[NL80211_ATTR_IE]))
3145 + return -EINVAL;
3146 +
3147 +diff --git a/net/wireless/util.c b/net/wireless/util.c
3148 +index baf7218cec15..1d239564baa3 100644
3149 +--- a/net/wireless/util.c
3150 ++++ b/net/wireless/util.c
3151 +@@ -1360,7 +1360,7 @@ bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,
3152 + u8 *op_class)
3153 + {
3154 + u8 vht_opclass;
3155 +- u16 freq = chandef->center_freq1;
3156 ++ u32 freq = chandef->center_freq1;
3157 +
3158 + if (freq >= 2412 && freq <= 2472) {
3159 + if (chandef->width > NL80211_CHAN_WIDTH_40)
3160 +diff --git a/sound/aoa/core/gpio-feature.c b/sound/aoa/core/gpio-feature.c
3161 +index f34153962d07..585b594bd838 100644
3162 +--- a/sound/aoa/core/gpio-feature.c
3163 ++++ b/sound/aoa/core/gpio-feature.c
3164 +@@ -88,8 +88,10 @@ static struct device_node *get_gpio(char *name,
3165 + }
3166 +
3167 + reg = of_get_property(np, "reg", NULL);
3168 +- if (!reg)
3169 ++ if (!reg) {
3170 ++ of_node_put(np);
3171 + return NULL;
3172 ++ }
3173 +
3174 + *gpioptr = *reg;
3175 +
3176 +diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
3177 +index cabccb10210e..95a82e428f37 100644
3178 +--- a/sound/pci/hda/hda_intel.c
3179 ++++ b/sound/pci/hda/hda_intel.c
3180 +@@ -2360,7 +2360,8 @@ static const struct pci_device_id azx_ids[] = {
3181 + .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB },
3182 + /* AMD Raven */
3183 + { PCI_DEVICE(0x1022, 0x15e3),
3184 +- .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB },
3185 ++ .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB |
3186 ++ AZX_DCAPS_PM_RUNTIME },
3187 + /* ATI HDMI */
3188 + { PCI_DEVICE(0x1002, 0x0002),
3189 + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS },
3190 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
3191 +index d706a416b587..0467e5ba82e0 100644
3192 +--- a/sound/pci/hda/patch_realtek.c
3193 ++++ b/sound/pci/hda/patch_realtek.c
3194 +@@ -5642,6 +5642,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
3195 + SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
3196 + SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
3197 + SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
3198 ++ SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
3199 + SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
3200 + SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
3201 + SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
3202 +diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
3203 +index 9e784cc3e5d2..0aefed8ab0cf 100644
3204 +--- a/sound/soc/soc-dapm.c
3205 ++++ b/sound/soc/soc-dapm.c
3206 +@@ -3864,6 +3864,13 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card)
3207 + continue;
3208 + }
3209 +
3210 ++ /* let users know there is no DAI to link */
3211 ++ if (!dai_w->priv) {
3212 ++ dev_dbg(card->dev, "dai widget %s has no DAI\n",
3213 ++ dai_w->name);
3214 ++ continue;
3215 ++ }
3216 ++
3217 + dai = dai_w->priv;
3218 +
3219 + /* ...find all widgets with the same stream and link them */
3220 +diff --git a/tools/perf/arch/powerpc/util/sym-handling.c b/tools/perf/arch/powerpc/util/sym-handling.c
3221 +index bbc1a50768dd..873f19f1a771 100644
3222 +--- a/tools/perf/arch/powerpc/util/sym-handling.c
3223 ++++ b/tools/perf/arch/powerpc/util/sym-handling.c
3224 +@@ -27,15 +27,16 @@ void arch__elf_sym_adjust(GElf_Sym *sym)
3225 + #endif
3226 + #endif
3227 +
3228 +-#if !defined(_CALL_ELF) || _CALL_ELF != 2
3229 + int arch__choose_best_symbol(struct symbol *syma,
3230 + struct symbol *symb __maybe_unused)
3231 + {
3232 + char *sym = syma->name;
3233 +
3234 ++#if !defined(_CALL_ELF) || _CALL_ELF != 2
3235 + /* Skip over any initial dot */
3236 + if (*sym == '.')
3237 + sym++;
3238 ++#endif
3239 +
3240 + /* Avoid "SyS" kernel syscall aliases */
3241 + if (strlen(sym) >= 3 && !strncmp(sym, "SyS", 3))
3242 +@@ -46,6 +47,7 @@ int arch__choose_best_symbol(struct symbol *syma,
3243 + return SYMBOL_A;
3244 + }
3245 +
3246 ++#if !defined(_CALL_ELF) || _CALL_ELF != 2
3247 + /* Allow matching against dot variants */
3248 + int arch__compare_symbol_names(const char *namea, const char *nameb)
3249 + {
3250 +diff --git a/tools/vm/page-types.c b/tools/vm/page-types.c
3251 +index 5a6016224bb9..c7fcc84fc0c0 100644
3252 +--- a/tools/vm/page-types.c
3253 ++++ b/tools/vm/page-types.c
3254 +@@ -150,12 +150,6 @@ static const char * const page_flag_names[] = {
3255 + };
3256 +
3257 +
3258 +-static const char * const debugfs_known_mountpoints[] = {
3259 +- "/sys/kernel/debug",
3260 +- "/debug",
3261 +- 0,
3262 +-};
3263 +-
3264 + /*
3265 + * data structures
3266 + */
3267 +diff --git a/tools/vm/slabinfo.c b/tools/vm/slabinfo.c
3268 +index 499b8819d4c6..5173a191cd03 100644
3269 +--- a/tools/vm/slabinfo.c
3270 ++++ b/tools/vm/slabinfo.c
3271 +@@ -29,8 +29,8 @@ struct slabinfo {
3272 + int alias;
3273 + int refs;
3274 + int aliases, align, cache_dma, cpu_slabs, destroy_by_rcu;
3275 +- int hwcache_align, object_size, objs_per_slab;
3276 +- int sanity_checks, slab_size, store_user, trace;
3277 ++ unsigned int hwcache_align, object_size, objs_per_slab;
3278 ++ unsigned int sanity_checks, slab_size, store_user, trace;
3279 + int order, poison, reclaim_account, red_zone;
3280 + unsigned long partial, objects, slabs, objects_partial, objects_total;
3281 + unsigned long alloc_fastpath, alloc_slowpath;