From: Greg Kroah-Hartman Date: Thu, 21 Apr 2022 08:37:42 +0000 (+0200) Subject: 4.9-stable patches X-Git-Tag: v4.9.312~90 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=df91ea7b64f1a6e34f8bd21d91ade6335d5ba91c;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches added patches: etherdevice-adjust-ether_addr-prototypes-to-silence-wstringop-overead.patch mm-page_alloc-fix-building-error-on-werror-array-compare.patch --- diff --git a/queue-4.14/series b/queue-4.14/series new file mode 100644 index 00000000000..74c2566da6a --- /dev/null +++ b/queue-4.14/series @@ -0,0 +1,2 @@ +etherdevice-adjust-ether_addr-prototypes-to-silence-wstringop-overead.patch +mm-page_alloc-fix-building-error-on-werror-array-compare.patch diff --git a/queue-4.19/series b/queue-4.19/series new file mode 100644 index 00000000000..74c2566da6a --- /dev/null +++ b/queue-4.19/series @@ -0,0 +1,2 @@ +etherdevice-adjust-ether_addr-prototypes-to-silence-wstringop-overead.patch +mm-page_alloc-fix-building-error-on-werror-array-compare.patch diff --git a/queue-4.9/etherdevice-adjust-ether_addr-prototypes-to-silence-wstringop-overead.patch b/queue-4.9/etherdevice-adjust-ether_addr-prototypes-to-silence-wstringop-overead.patch new file mode 100644 index 00000000000..31b2b1e52e6 --- /dev/null +++ b/queue-4.9/etherdevice-adjust-ether_addr-prototypes-to-silence-wstringop-overead.patch @@ -0,0 +1,62 @@ +From 2618a0dae09ef37728dab89ff60418cbe25ae6bd Mon Sep 17 00:00:00 2001 +From: Kees Cook +Date: Sat, 12 Feb 2022 09:14:49 -0800 +Subject: etherdevice: Adjust ether_addr* prototypes to silence -Wstringop-overead +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Kees Cook + +commit 2618a0dae09ef37728dab89ff60418cbe25ae6bd upstream. + +With GCC 12, -Wstringop-overread was warning about an implicit cast from +char[6] to char[8]. However, the extra 2 bytes are always thrown away, +alignment doesn't matter, and the risk of hitting the edge of unallocated +memory has been accepted, so this prototype can just be converted to a +regular char *. Silences: + +net/core/dev.c: In function ‘bpf_prog_run_generic_xdp’: net/core/dev.c:4618:21: warning: ‘ether_addr_equal_64bits’ reading 8 bytes from a region of size 6 [-Wstringop-overread] + 4618 | orig_host = ether_addr_equal_64bits(eth->h_dest, > skb->dev->dev_addr); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +net/core/dev.c:4618:21: note: referencing argument 1 of type ‘const u8[8]’ {aka ‘const unsigned char[8]’} +net/core/dev.c:4618:21: note: referencing argument 2 of type ‘const u8[8]’ {aka ‘const unsigned char[8]’} +In file included from net/core/dev.c:91: include/linux/etherdevice.h:375:20: note: in a call to function ‘ether_addr_equal_64bits’ + 375 | static inline bool ether_addr_equal_64bits(const u8 addr1[6+2], + | ^~~~~~~~~~~~~~~~~~~~~~~ + +Reported-by: Marc Kleine-Budde +Tested-by: Marc Kleine-Budde +Link: https://lore.kernel.org/netdev/20220212090811.uuzk6d76agw2vv73@pengutronix.de +Cc: Jakub Kicinski +Cc: "David S. Miller" +Cc: netdev@vger.kernel.org +Signed-off-by: Kees Cook +Signed-off-by: David S. Miller +Cc: Khem Raj +Signed-off-by: Greg Kroah-Hartman +--- + include/linux/etherdevice.h | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +--- a/include/linux/etherdevice.h ++++ b/include/linux/etherdevice.h +@@ -125,7 +125,7 @@ static inline bool is_multicast_ether_ad + #endif + } + +-static inline bool is_multicast_ether_addr_64bits(const u8 addr[6+2]) ++static inline bool is_multicast_ether_addr_64bits(const u8 *addr) + { + #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 + #ifdef __BIG_ENDIAN +@@ -339,8 +339,7 @@ static inline bool ether_addr_equal(cons + * Please note that alignment of addr1 & addr2 are only guaranteed to be 16 bits. + */ + +-static inline bool ether_addr_equal_64bits(const u8 addr1[6+2], +- const u8 addr2[6+2]) ++static inline bool ether_addr_equal_64bits(const u8 *addr1, const u8 *addr2) + { + #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 + u64 fold = (*(const u64 *)addr1) ^ (*(const u64 *)addr2); diff --git a/queue-4.9/mm-page_alloc-fix-building-error-on-werror-array-compare.patch b/queue-4.9/mm-page_alloc-fix-building-error-on-werror-array-compare.patch new file mode 100644 index 00000000000..c7679e3c4b9 --- /dev/null +++ b/queue-4.9/mm-page_alloc-fix-building-error-on-werror-array-compare.patch @@ -0,0 +1,42 @@ +From ca831f29f8f25c97182e726429b38c0802200c8f Mon Sep 17 00:00:00 2001 +From: Xiongwei Song +Date: Fri, 14 Jan 2022 14:07:24 -0800 +Subject: mm: page_alloc: fix building error on -Werror=array-compare + +From: Xiongwei Song + +commit ca831f29f8f25c97182e726429b38c0802200c8f upstream. + +Arthur Marsh reported we would hit the error below when building kernel +with gcc-12: + + CC mm/page_alloc.o + mm/page_alloc.c: In function `mem_init_print_info': + mm/page_alloc.c:8173:27: error: comparison between two arrays [-Werror=array-compare] + 8173 | if (start <= pos && pos < end && size > adj) \ + | + +In C++20, the comparision between arrays should be warned. + +Link: https://lkml.kernel.org/r/20211125130928.32465-1-sxwjean@me.com +Signed-off-by: Xiongwei Song +Reported-by: Arthur Marsh +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Cc: Khem Raj +Signed-off-by: Greg Kroah-Hartman +--- + mm/page_alloc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/mm/page_alloc.c ++++ b/mm/page_alloc.c +@@ -6504,7 +6504,7 @@ void __init mem_init_print_info(const ch + */ + #define adj_init_size(start, end, size, pos, adj) \ + do { \ +- if (start <= pos && pos < end && size > adj) \ ++ if (&start[0] <= &pos[0] && &pos[0] < &end[0] && size > adj) \ + size -= adj; \ + } while (0) + diff --git a/queue-4.9/series b/queue-4.9/series new file mode 100644 index 00000000000..74c2566da6a --- /dev/null +++ b/queue-4.9/series @@ -0,0 +1,2 @@ +etherdevice-adjust-ether_addr-prototypes-to-silence-wstringop-overead.patch +mm-page_alloc-fix-building-error-on-werror-array-compare.patch diff --git a/queue-5.10/series b/queue-5.10/series new file mode 100644 index 00000000000..74c2566da6a --- /dev/null +++ b/queue-5.10/series @@ -0,0 +1,2 @@ +etherdevice-adjust-ether_addr-prototypes-to-silence-wstringop-overead.patch +mm-page_alloc-fix-building-error-on-werror-array-compare.patch diff --git a/queue-5.17/series b/queue-5.17/series new file mode 100644 index 00000000000..790e342c663 --- /dev/null +++ b/queue-5.17/series @@ -0,0 +1 @@ +etherdevice-adjust-ether_addr-prototypes-to-silence-wstringop-overead.patch diff --git a/queue-5.4/series b/queue-5.4/series new file mode 100644 index 00000000000..74c2566da6a --- /dev/null +++ b/queue-5.4/series @@ -0,0 +1,2 @@ +etherdevice-adjust-ether_addr-prototypes-to-silence-wstringop-overead.patch +mm-page_alloc-fix-building-error-on-werror-array-compare.patch