From: Greg Kroah-Hartman Date: Wed, 9 Nov 2016 10:08:43 +0000 (+0100) Subject: 4.4-stable patches X-Git-Tag: v4.4.31~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=25ff8dc46c0e50085305b53395442dbb572e6753;p=thirdparty%2Fkernel%2Fstable-queue.git 4.4-stable patches added patches: arm-8584-1-floppy-avoid-gcc-6-warning.patch cgroup-avoid-false-positive-gcc-6-warning.patch disable-frame-address-warning.patch drm-exynos-fix-error-handling-in-exynos_drm_subdrv_open.patch mm-cma-silence-warnings-due-to-max-usage.patch powerpc-ptrace-fix-out-of-bounds-array-access-warning.patch smc91x-avoid-self-comparison-warning.patch --- diff --git a/queue-4.4/arm-8584-1-floppy-avoid-gcc-6-warning.patch b/queue-4.4/arm-8584-1-floppy-avoid-gcc-6-warning.patch new file mode 100644 index 00000000000..e007ba9a080 --- /dev/null +++ b/queue-4.4/arm-8584-1-floppy-avoid-gcc-6-warning.patch @@ -0,0 +1,43 @@ +From dd665be0e243873343a28e18f9f345927b658daf Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Fri, 1 Jul 2016 18:02:22 +0100 +Subject: ARM: 8584/1: floppy: avoid gcc-6 warning + +From: Arnd Bergmann + +commit dd665be0e243873343a28e18f9f345927b658daf upstream. + +gcc-6.0 warns about comparisons between two identical expressions, +which is what we get in the floppy driver when writing to the FD_DOR +register: + +drivers/block/floppy.c: In function 'set_dor': +drivers/block/floppy.c:810:44: error: self-comparison always evaluates to true [-Werror=tautological-compare] + fd_outb(newdor, FD_DOR); + +It would be nice to use a static inline function instead of the +macro, to avoid the warning, but we cannot do that because the +FD_DOR definition is incomplete at this point. + +Adding a cast to (u32) is a harmless way to shut up the warning, +just not very nice. + +Signed-off-by: Arnd Bergmann +Signed-off-by: Russell King +Signed-off-by: Greg Kroah-Hartman + +--- + arch/arm/include/asm/floppy.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm/include/asm/floppy.h ++++ b/arch/arm/include/asm/floppy.h +@@ -17,7 +17,7 @@ + + #define fd_outb(val,port) \ + do { \ +- if ((port) == FD_DOR) \ ++ if ((port) == (u32)FD_DOR) \ + fd_setdor((val)); \ + else \ + outb((val),(port)); \ diff --git a/queue-4.4/cgroup-avoid-false-positive-gcc-6-warning.patch b/queue-4.4/cgroup-avoid-false-positive-gcc-6-warning.patch new file mode 100644 index 00000000000..40dd1595c61 --- /dev/null +++ b/queue-4.4/cgroup-avoid-false-positive-gcc-6-warning.patch @@ -0,0 +1,46 @@ +From cfe02a8a973e7e5f66926b8ae38dfce404b19e29 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Tue, 15 Mar 2016 00:21:06 +0100 +Subject: cgroup: avoid false positive gcc-6 warning + +From: Arnd Bergmann + +commit cfe02a8a973e7e5f66926b8ae38dfce404b19e29 upstream. + +When all subsystems are disabled, gcc notices that cgroup_subsys_enabled_key +is a zero-length array and that any access to it must be out of bounds: + +In file included from ../include/linux/cgroup.h:19:0, + from ../kernel/cgroup.c:31: +../kernel/cgroup.c: In function 'cgroup_add_cftypes': +../kernel/cgroup.c:261:53: error: array subscript is above array bounds [-Werror=array-bounds] + return static_key_enabled(cgroup_subsys_enabled_key[ssid]); + ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~ +../include/linux/jump_label.h:271:40: note: in definition of macro 'static_key_enabled' + static_key_count((struct static_key *)x) > 0; \ + ^ + +We should never call the function in this particular case, so this is +not a bug. In order to silence the warning, this adds an explicit check +for the CGROUP_SUBSYS_COUNT==0 case. + +Signed-off-by: Arnd Bergmann +Signed-off-by: Tejun Heo +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/cgroup.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/kernel/cgroup.c ++++ b/kernel/cgroup.c +@@ -236,6 +236,9 @@ static int cgroup_addrm_files(struct cgr + */ + static bool cgroup_ssid_enabled(int ssid) + { ++ if (CGROUP_SUBSYS_COUNT == 0) ++ return false; ++ + return static_key_enabled(cgroup_subsys_enabled_key[ssid]); + } + diff --git a/queue-4.4/disable-frame-address-warning.patch b/queue-4.4/disable-frame-address-warning.patch new file mode 100644 index 00000000000..2a3869a516b --- /dev/null +++ b/queue-4.4/disable-frame-address-warning.patch @@ -0,0 +1,55 @@ +From 124a3d88fa20e1869fc229d7d8c740cc81944264 Mon Sep 17 00:00:00 2001 +From: Linus Torvalds +Date: Wed, 27 Jul 2016 19:03:04 -0700 +Subject: Disable "frame-address" warning +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Linus Torvalds + +commit 124a3d88fa20e1869fc229d7d8c740cc81944264 upstream. + +Newer versions of gcc warn about the use of __builtin_return_address() +with a non-zero argument when "-Wall" is specified: + + kernel/trace/trace_irqsoff.c: In function ‘stop_critical_timings’: + kernel/trace/trace_irqsoff.c:433:86: warning: calling ‘__builtin_return_address’ with a nonzero argument is unsafe [-Wframe-address] + stop_critical_timing(CALLER_ADDR0, CALLER_ADDR1); + [ .. repeats a few times for other similar cases .. ] + +It is true that a non-zero argument is somewhat dangerous, and we do not +actually have very many uses of that in the kernel - but the ftrace code +does use it, and as Stephen Rostedt says: + + "We are well aware of the danger of using __builtin_return_address() of + > 0. In fact that's part of the reason for having the "thunk" code in + x86 (See arch/x86/entry/thunk_{64,32}.S). [..] it adds extra frames + when tracking irqs off sections, to prevent __builtin_return_address() + from accessing bad areas. In fact the thunk_32.S states: 'Trampoline to + trace irqs off. (otherwise CALLER_ADDR1 might crash)'." + +For now, __builtin_return_address() with a non-zero argument is the best +we can do, and the warning is not helpful and can end up making people +miss other warnings for real problems. + +So disable the frame-address warning on compilers that need it. + +Acked-by: Steven Rostedt +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + Makefile | 1 + + 1 file changed, 1 insertion(+) + +--- a/Makefile ++++ b/Makefile +@@ -617,6 +617,7 @@ include arch/$(SRCARCH)/Makefile + + KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) + KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,) ++KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,) + + ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE + KBUILD_CFLAGS += -Os diff --git a/queue-4.4/drm-exynos-fix-error-handling-in-exynos_drm_subdrv_open.patch b/queue-4.4/drm-exynos-fix-error-handling-in-exynos_drm_subdrv_open.patch new file mode 100644 index 00000000000..46ab59230d8 --- /dev/null +++ b/queue-4.4/drm-exynos-fix-error-handling-in-exynos_drm_subdrv_open.patch @@ -0,0 +1,46 @@ +From 55c4b906aa2aec3fa66310ec03c6842e34a04b2a Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Mon, 14 Mar 2016 15:22:25 +0100 +Subject: drm/exynos: fix error handling in exynos_drm_subdrv_open + +From: Arnd Bergmann + +commit 55c4b906aa2aec3fa66310ec03c6842e34a04b2a upstream. + +gcc-6 warns about a pointless loop in exynos_drm_subdrv_open: + +drivers/gpu/drm/exynos/exynos_drm_core.c: In function 'exynos_drm_subdrv_open': +drivers/gpu/drm/exynos/exynos_drm_core.c:104:199: error: self-comparison always evaluates to false [-Werror=tautological-compare] + list_for_each_entry_reverse(subdrv, &subdrv->list, list) { + +Here, the list_for_each_entry_reverse immediately terminates because +the subdrv pointer is compared to itself as the loop end condition. + +If we were to take the current subdrv pointer as the start of the +list (as we would do if list_for_each_entry_reverse() was not a macro), +we would iterate backwards over the &exynos_drm_subdrv_list anchor, +which would be even worse. + +Instead, we need to use list_for_each_entry_continue_reverse() +to go back over each subdrv that was successfully opened until +the first entry. + +Signed-off-by: Arnd Bergmann +Signed-off-by: Inki Dae +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/exynos/exynos_drm_core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/gpu/drm/exynos/exynos_drm_core.c ++++ b/drivers/gpu/drm/exynos/exynos_drm_core.c +@@ -101,7 +101,7 @@ int exynos_drm_subdrv_open(struct drm_de + return 0; + + err: +- list_for_each_entry_reverse(subdrv, &subdrv->list, list) { ++ list_for_each_entry_continue_reverse(subdrv, &exynos_drm_subdrv_list, list) { + if (subdrv->close) + subdrv->close(dev, subdrv->dev, file); + } diff --git a/queue-4.4/mm-cma-silence-warnings-due-to-max-usage.patch b/queue-4.4/mm-cma-silence-warnings-due-to-max-usage.patch new file mode 100644 index 00000000000..fab7493a553 --- /dev/null +++ b/queue-4.4/mm-cma-silence-warnings-due-to-max-usage.patch @@ -0,0 +1,78 @@ +From badbda53e505089062e194c614e6f23450bc98b2 Mon Sep 17 00:00:00 2001 +From: Stephen Rothwell +Date: Fri, 27 May 2016 14:27:41 -0700 +Subject: mm/cma: silence warnings due to max() usage + +From: Stephen Rothwell + +commit badbda53e505089062e194c614e6f23450bc98b2 upstream. + +pageblock_order can be (at least) an unsigned int or an unsigned long +depending on the kernel config and architecture, so use max_t(unsigned +long, ...) when comparing it. + +fixes these warnings: + +In file included from include/asm-generic/bug.h:13:0, + from arch/powerpc/include/asm/bug.h:127, + from include/linux/bug.h:4, + from include/linux/mmdebug.h:4, + from include/linux/mm.h:8, + from include/linux/memblock.h:18, + from mm/cma.c:28: +mm/cma.c: In function 'cma_init_reserved_mem': +include/linux/kernel.h:748:17: warning: comparison of distinct pointer types lacks a cast + (void) (&_max1 == &_max2); ^ +mm/cma.c:186:27: note: in expansion of macro 'max' + alignment = PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order); + ^ +mm/cma.c: In function 'cma_declare_contiguous': +include/linux/kernel.h:748:17: warning: comparison of distinct pointer types lacks a cast + (void) (&_max1 == &_max2); ^ +include/linux/kernel.h:747:9: note: in definition of macro 'max' + typeof(y) _max2 = (y); ^ +mm/cma.c:270:29: note: in expansion of macro 'max' + (phys_addr_t)PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order)); + ^ +include/linux/kernel.h:748:17: warning: comparison of distinct pointer types lacks a cast + (void) (&_max1 == &_max2); ^ +include/linux/kernel.h:747:21: note: in definition of macro 'max' + typeof(y) _max2 = (y); ^ +mm/cma.c:270:29: note: in expansion of macro 'max' + (phys_addr_t)PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order)); + ^ + +[akpm@linux-foundation.org: coding-style fixes] +Link: http://lkml.kernel.org/r/20160526150748.5be38a4f@canb.auug.org.au +Signed-off-by: Stephen Rothwell +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + mm/cma.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +--- a/mm/cma.c ++++ b/mm/cma.c +@@ -183,7 +183,8 @@ int __init cma_init_reserved_mem(phys_ad + return -EINVAL; + + /* ensure minimal alignment required by mm core */ +- alignment = PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order); ++ alignment = PAGE_SIZE << ++ max_t(unsigned long, MAX_ORDER - 1, pageblock_order); + + /* alignment should be aligned with order_per_bit */ + if (!IS_ALIGNED(alignment >> PAGE_SHIFT, 1 << order_per_bit)) +@@ -266,8 +267,8 @@ int __init cma_declare_contiguous(phys_a + * migratetype page by page allocator's buddy algorithm. In the case, + * you couldn't get a contiguous memory, which is not what we want. + */ +- alignment = max(alignment, +- (phys_addr_t)PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order)); ++ alignment = max(alignment, (phys_addr_t)PAGE_SIZE << ++ max_t(unsigned long, MAX_ORDER - 1, pageblock_order)); + base = ALIGN(base, alignment); + size = ALIGN(size, alignment); + limit &= ~(alignment - 1); diff --git a/queue-4.4/powerpc-ptrace-fix-out-of-bounds-array-access-warning.patch b/queue-4.4/powerpc-ptrace-fix-out-of-bounds-array-access-warning.patch new file mode 100644 index 00000000000..98659a3f410 --- /dev/null +++ b/queue-4.4/powerpc-ptrace-fix-out-of-bounds-array-access-warning.patch @@ -0,0 +1,51 @@ +From 1e407ee3b21f981140491d5b8a36422979ca246f Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Mon, 25 Apr 2016 09:19:17 -0700 +Subject: powerpc/ptrace: Fix out of bounds array access warning + +From: Khem Raj + +commit 1e407ee3b21f981140491d5b8a36422979ca246f upstream. + +gcc-6 correctly warns about a out of bounds access + +arch/powerpc/kernel/ptrace.c:407:24: warning: index 32 denotes an offset greater than size of 'u64[32][1] {aka long long unsigned int[32][1]}' [-Warray-bounds] + offsetof(struct thread_fp_state, fpr[32][0])); + ^ + +check the end of array instead of beginning of next element to fix this + +Signed-off-by: Khem Raj +Cc: Kees Cook +Cc: Michael Ellerman +Cc: Segher Boessenkool +Tested-by: Aaro Koskinen +Acked-by: Olof Johansson +Signed-off-by: Michael Ellerman +Cc: Arnd Bergmann +Signed-off-by: Greg Kroah-Hartman + +--- + arch/powerpc/kernel/ptrace.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/powerpc/kernel/ptrace.c ++++ b/arch/powerpc/kernel/ptrace.c +@@ -376,7 +376,7 @@ static int fpr_get(struct task_struct *t + + #else + BUILD_BUG_ON(offsetof(struct thread_fp_state, fpscr) != +- offsetof(struct thread_fp_state, fpr[32][0])); ++ offsetof(struct thread_fp_state, fpr[32])); + + return user_regset_copyout(&pos, &count, &kbuf, &ubuf, + &target->thread.fp_state, 0, -1); +@@ -404,7 +404,7 @@ static int fpr_set(struct task_struct *t + return 0; + #else + BUILD_BUG_ON(offsetof(struct thread_fp_state, fpscr) != +- offsetof(struct thread_fp_state, fpr[32][0])); ++ offsetof(struct thread_fp_state, fpr[32])); + + return user_regset_copyin(&pos, &count, &kbuf, &ubuf, + &target->thread.fp_state, 0, -1); diff --git a/queue-4.4/series b/queue-4.4/series index a612b9da2d3..9740087136a 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -53,3 +53,10 @@ drm-radeon-drop-register-readback-in-cayman_cp_int_cntl_setup.patch drm-dp-mst-check-peer-device-type-before-attempting-edid-read.patch perf-build-fix-traceevent-plugins-build-race.patch x86-xen-fix-upper-bound-of-pmd-loop-in-xen_cleanhighmap.patch +powerpc-ptrace-fix-out-of-bounds-array-access-warning.patch +arm-8584-1-floppy-avoid-gcc-6-warning.patch +mm-cma-silence-warnings-due-to-max-usage.patch +drm-exynos-fix-error-handling-in-exynos_drm_subdrv_open.patch +cgroup-avoid-false-positive-gcc-6-warning.patch +smc91x-avoid-self-comparison-warning.patch +disable-frame-address-warning.patch diff --git a/queue-4.4/smc91x-avoid-self-comparison-warning.patch b/queue-4.4/smc91x-avoid-self-comparison-warning.patch new file mode 100644 index 00000000000..116a6f50dc1 --- /dev/null +++ b/queue-4.4/smc91x-avoid-self-comparison-warning.patch @@ -0,0 +1,43 @@ +From e3ebd894f084255fde19116955ba7054858ff5d6 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Mon, 14 Mar 2016 23:45:12 +0100 +Subject: smc91x: avoid self-comparison warning + +From: Arnd Bergmann + +commit e3ebd894f084255fde19116955ba7054858ff5d6 upstream. + +The smc91x driver defines a macro that compares its argument to +itself, apparently to get a true result while using its argument +to avoid a warning about unused local variables. + +Unfortunately, this triggers a warning with gcc-6, as the comparison +is obviously useless: + +drivers/net/ethernet/smsc/smc91x.c: In function 'smc_hardware_send_pkt': +drivers/net/ethernet/smsc/smc91x.c:563:14: error: self-comparison always evaluates to true [-Werror=tautological-compare] + if (!smc_special_trylock(&lp->lock, flags)) { + +This replaces the macro with another one that behaves similarly, +with a cast to (void) to ensure the argument is used, and using +a literal 'true' as its value. + +Signed-off-by: Arnd Bergmann +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/ethernet/smsc/smc91x.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/ethernet/smsc/smc91x.c ++++ b/drivers/net/ethernet/smsc/smc91x.c +@@ -540,7 +540,7 @@ static inline void smc_rcv(struct net_d + #define smc_special_lock(lock, flags) spin_lock_irqsave(lock, flags) + #define smc_special_unlock(lock, flags) spin_unlock_irqrestore(lock, flags) + #else +-#define smc_special_trylock(lock, flags) (flags == flags) ++#define smc_special_trylock(lock, flags) ((void)flags, true) + #define smc_special_lock(lock, flags) do { flags = 0; } while (0) + #define smc_special_unlock(lock, flags) do { flags = 0; } while (0) + #endif