From: Greg Kroah-Hartman Date: Thu, 23 Jun 2022 16:08:13 +0000 (+0200) Subject: 5.18-stable patches X-Git-Tag: v4.9.320~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a5ccbcb8ed6799ee8a1281bd3224b552e638b6f8;p=thirdparty%2Fkernel%2Fstable-queue.git 5.18-stable patches added patches: eth-sun-cassini-remove-dead-code.patch net-wwan-iosm-remove-pointless-null-check.patch wifi-rtlwifi-remove-always-true-condition-pointed-out-by-gcc-12.patch x86-boot-wrap-literal-addresses-in-absolute_pointer.patch --- diff --git a/queue-5.18/eth-sun-cassini-remove-dead-code.patch b/queue-5.18/eth-sun-cassini-remove-dead-code.patch new file mode 100644 index 00000000000..61cf5978e24 --- /dev/null +++ b/queue-5.18/eth-sun-cassini-remove-dead-code.patch @@ -0,0 +1,48 @@ +From 32329216ca1d6ee29c41215f18b3053bb6158541 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Martin=20Li=C5=A1ka?= +Date: Wed, 18 May 2022 09:18:53 +0200 +Subject: eth: sun: cassini: remove dead code +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Martin Liška + +commit 32329216ca1d6ee29c41215f18b3053bb6158541 upstream. + +Fixes the following GCC warning: + +drivers/net/ethernet/sun/cassini.c:1316:29: error: comparison between two arrays [-Werror=array-compare] +drivers/net/ethernet/sun/cassini.c:3783:34: error: comparison between two arrays [-Werror=array-compare] + +Note that 2 arrays should be compared by comparing of their addresses: +note: use ‘&cas_prog_workaroundtab[0] == &cas_prog_null[0]’ to compare the addresses + +Signed-off-by: Martin Liska +Signed-off-by: David S. Miller +Cc: Sudip Mukherjee +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/sun/cassini.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/sun/cassini.c ++++ b/drivers/net/ethernet/sun/cassini.c +@@ -1313,7 +1313,7 @@ static void cas_init_rx_dma(struct cas * + writel(val, cp->regs + REG_RX_PAGE_SIZE); + + /* enable the header parser if desired */ +- if (CAS_HP_FIRMWARE == cas_prog_null) ++ if (&CAS_HP_FIRMWARE[0] == &cas_prog_null[0]) + return; + + val = CAS_BASE(HP_CFG_NUM_CPU, CAS_NCPUS > 63 ? 0 : CAS_NCPUS); +@@ -3780,7 +3780,7 @@ static void cas_reset(struct cas *cp, in + + /* program header parser */ + if ((cp->cas_flags & CAS_FLAG_TARGET_ABORT) || +- (CAS_HP_ALT_FIRMWARE == cas_prog_null)) { ++ (&CAS_HP_ALT_FIRMWARE[0] == &cas_prog_null[0])) { + cas_load_firmware(cp, CAS_HP_FIRMWARE); + } else { + cas_load_firmware(cp, CAS_HP_ALT_FIRMWARE); diff --git a/queue-5.18/net-wwan-iosm-remove-pointless-null-check.patch b/queue-5.18/net-wwan-iosm-remove-pointless-null-check.patch new file mode 100644 index 00000000000..a2d61654848 --- /dev/null +++ b/queue-5.18/net-wwan-iosm-remove-pointless-null-check.patch @@ -0,0 +1,58 @@ +From dbbc7d04c549a43ad343c69e17b27a57e2102041 Mon Sep 17 00:00:00 2001 +From: Jakub Kicinski +Date: Wed, 18 May 2022 17:43:42 -0700 +Subject: net: wwan: iosm: remove pointless null check +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Jakub Kicinski + +commit dbbc7d04c549a43ad343c69e17b27a57e2102041 upstream. + +GCC 12 warns: + +drivers/net/wwan/iosm/iosm_ipc_protocol_ops.c: In function ‘ipc_protocol_dl_td_process’: +drivers/net/wwan/iosm/iosm_ipc_protocol_ops.c:406:13: warning: the comparison will always evaluate as ‘true’ for the address of ‘cb’ will never be NULL [-Waddress] + 406 | if (!IPC_CB(skb)) { + | ^ + +Indeed the check seems entirely pointless. Hopefully the other +validation checks will catch if the cb is bad, but it can't be +NULL. + +Reviewed-by: M Chetan Kumar +Link: https://lore.kernel.org/r/20220519004342.2109832-1-kuba@kernel.org +Signed-off-by: Jakub Kicinski +Cc: Sudip Mukherjee +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/wwan/iosm/iosm_ipc_protocol_ops.c | 10 ---------- + 1 file changed, 10 deletions(-) + +--- a/drivers/net/wwan/iosm/iosm_ipc_protocol_ops.c ++++ b/drivers/net/wwan/iosm/iosm_ipc_protocol_ops.c +@@ -372,8 +372,6 @@ bool ipc_protocol_dl_td_prepare(struct i + struct sk_buff *ipc_protocol_dl_td_process(struct iosm_protocol *ipc_protocol, + struct ipc_pipe *pipe) + { +- u32 tail = +- le32_to_cpu(ipc_protocol->p_ap_shm->tail_array[pipe->pipe_nr]); + struct ipc_protocol_td *p_td; + struct sk_buff *skb; + +@@ -401,14 +399,6 @@ struct sk_buff *ipc_protocol_dl_td_proce + ipc_pcie_kfree_skb(ipc_protocol->pcie, skb); + skb = NULL; + goto ret; +- } +- +- if (!IPC_CB(skb)) { +- dev_err(ipc_protocol->dev, "pipe# %d, tail: %d skb_cb is NULL", +- pipe->pipe_nr, tail); +- ipc_pcie_kfree_skb(ipc_protocol->pcie, skb); +- skb = NULL; +- goto ret; + } + + if (p_td->buffer.address != IPC_CB(skb)->mapping) { diff --git a/queue-5.18/series b/queue-5.18/series index e668d35b79b..83ef31eeae4 100644 --- a/queue-5.18/series +++ b/queue-5.18/series @@ -1,2 +1,6 @@ s390-mm-use-non-quiescing-sske-for-kvm-switch-to-keyed-guest.patch zonefs-fix-zonefs_iomap_begin-for-reads.patch +wifi-rtlwifi-remove-always-true-condition-pointed-out-by-gcc-12.patch +eth-sun-cassini-remove-dead-code.patch +net-wwan-iosm-remove-pointless-null-check.patch +x86-boot-wrap-literal-addresses-in-absolute_pointer.patch diff --git a/queue-5.18/wifi-rtlwifi-remove-always-true-condition-pointed-out-by-gcc-12.patch b/queue-5.18/wifi-rtlwifi-remove-always-true-condition-pointed-out-by-gcc-12.patch new file mode 100644 index 00000000000..158a7f38b0f --- /dev/null +++ b/queue-5.18/wifi-rtlwifi-remove-always-true-condition-pointed-out-by-gcc-12.patch @@ -0,0 +1,38 @@ +From ee3db469dd317e82f57b13aa3bc61be5cb60c2b4 Mon Sep 17 00:00:00 2001 +From: Jakub Kicinski +Date: Fri, 20 May 2022 12:43:15 -0700 +Subject: wifi: rtlwifi: remove always-true condition pointed out by GCC 12 + +From: Jakub Kicinski + +commit ee3db469dd317e82f57b13aa3bc61be5cb60c2b4 upstream. + +The .value is a two-dim array, not a pointer. + +struct iqk_matrix_regs { + bool iqk_done; + long value[1][IQK_MATRIX_REG_NUM]; +}; + +Acked-by: Kalle Valo +Signed-off-by: Jakub Kicinski +Cc: Sudip Mukherjee +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c ++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c +@@ -2386,10 +2386,7 @@ void rtl92d_phy_reload_iqk_setting(struc + rtl_dbg(rtlpriv, COMP_SCAN, DBG_LOUD, + "Just Read IQK Matrix reg for channel:%d....\n", + channel); +- if ((rtlphy->iqk_matrix[indexforchannel]. +- value[0] != NULL) +- /*&&(regea4 != 0) */) +- _rtl92d_phy_patha_fill_iqk_matrix(hw, true, ++ _rtl92d_phy_patha_fill_iqk_matrix(hw, true, + rtlphy->iqk_matrix[ + indexforchannel].value, 0, + (rtlphy->iqk_matrix[ diff --git a/queue-5.18/x86-boot-wrap-literal-addresses-in-absolute_pointer.patch b/queue-5.18/x86-boot-wrap-literal-addresses-in-absolute_pointer.patch new file mode 100644 index 00000000000..f428de3a1c0 --- /dev/null +++ b/queue-5.18/x86-boot-wrap-literal-addresses-in-absolute_pointer.patch @@ -0,0 +1,142 @@ +From aeb84412037b89e06f45e382f044da6f200e12f8 Mon Sep 17 00:00:00 2001 +From: Kees Cook +Date: Sun, 27 Feb 2022 11:59:18 -0800 +Subject: x86/boot: Wrap literal addresses in absolute_pointer() + +From: Kees Cook + +commit aeb84412037b89e06f45e382f044da6f200e12f8 upstream. + +GCC 11 (incorrectly[1]) assumes that literal values cast to (void *) +should be treated like a NULL pointer with an offset, and raises +diagnostics when doing bounds checking under -Warray-bounds. GCC 12 +got "smarter" about finding these: + + In function 'rdfs8', + inlined from 'vga_recalc_vertical' at /srv/code/arch/x86/boot/video-mode.c:124:29, + inlined from 'set_mode' at /srv/code/arch/x86/boot/video-mode.c:163:3: + /srv/code/arch/x86/boot/boot.h:114:9: warning: array subscript 0 is outside array bounds of 'u8[0]' {aka 'unsigned char[]'} [-Warray-bounds] + 114 | asm volatile("movb %%fs:%1,%0" : "=q" (v) : "m" (*(u8 *)addr)); + | ^~~ + +This has been solved in other places[2] already by using the recently +added absolute_pointer() macro. Do the same here. + + [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578 + [2] https://lore.kernel.org/all/20210912160149.2227137-1-linux@roeck-us.net/ + +Signed-off-by: Kees Cook +Signed-off-by: Borislav Petkov +Reviewed-by: Guenter Roeck +Link: https://lore.kernel.org/r/20220227195918.705219-1-keescook@chromium.org +Cc: Jiri Slaby +Signed-off-by: Greg Kroah-Hartman +--- + arch/x86/boot/boot.h | 36 ++++++++++++++++++++++++------------ + arch/x86/boot/main.c | 2 +- + 2 files changed, 25 insertions(+), 13 deletions(-) + +--- a/arch/x86/boot/boot.h ++++ b/arch/x86/boot/boot.h +@@ -110,66 +110,78 @@ typedef unsigned int addr_t; + + static inline u8 rdfs8(addr_t addr) + { ++ u8 *ptr = (u8 *)absolute_pointer(addr); + u8 v; +- asm volatile("movb %%fs:%1,%0" : "=q" (v) : "m" (*(u8 *)addr)); ++ asm volatile("movb %%fs:%1,%0" : "=q" (v) : "m" (*ptr)); + return v; + } + static inline u16 rdfs16(addr_t addr) + { ++ u16 *ptr = (u16 *)absolute_pointer(addr); + u16 v; +- asm volatile("movw %%fs:%1,%0" : "=r" (v) : "m" (*(u16 *)addr)); ++ asm volatile("movw %%fs:%1,%0" : "=r" (v) : "m" (*ptr)); + return v; + } + static inline u32 rdfs32(addr_t addr) + { ++ u32 *ptr = (u32 *)absolute_pointer(addr); + u32 v; +- asm volatile("movl %%fs:%1,%0" : "=r" (v) : "m" (*(u32 *)addr)); ++ asm volatile("movl %%fs:%1,%0" : "=r" (v) : "m" (*ptr)); + return v; + } + + static inline void wrfs8(u8 v, addr_t addr) + { +- asm volatile("movb %1,%%fs:%0" : "+m" (*(u8 *)addr) : "qi" (v)); ++ u8 *ptr = (u8 *)absolute_pointer(addr); ++ asm volatile("movb %1,%%fs:%0" : "+m" (*ptr) : "qi" (v)); + } + static inline void wrfs16(u16 v, addr_t addr) + { +- asm volatile("movw %1,%%fs:%0" : "+m" (*(u16 *)addr) : "ri" (v)); ++ u16 *ptr = (u16 *)absolute_pointer(addr); ++ asm volatile("movw %1,%%fs:%0" : "+m" (*ptr) : "ri" (v)); + } + static inline void wrfs32(u32 v, addr_t addr) + { +- asm volatile("movl %1,%%fs:%0" : "+m" (*(u32 *)addr) : "ri" (v)); ++ u32 *ptr = (u32 *)absolute_pointer(addr); ++ asm volatile("movl %1,%%fs:%0" : "+m" (*ptr) : "ri" (v)); + } + + static inline u8 rdgs8(addr_t addr) + { ++ u8 *ptr = (u8 *)absolute_pointer(addr); + u8 v; +- asm volatile("movb %%gs:%1,%0" : "=q" (v) : "m" (*(u8 *)addr)); ++ asm volatile("movb %%gs:%1,%0" : "=q" (v) : "m" (*ptr)); + return v; + } + static inline u16 rdgs16(addr_t addr) + { ++ u16 *ptr = (u16 *)absolute_pointer(addr); + u16 v; +- asm volatile("movw %%gs:%1,%0" : "=r" (v) : "m" (*(u16 *)addr)); ++ asm volatile("movw %%gs:%1,%0" : "=r" (v) : "m" (*ptr)); + return v; + } + static inline u32 rdgs32(addr_t addr) + { ++ u32 *ptr = (u32 *)absolute_pointer(addr); + u32 v; +- asm volatile("movl %%gs:%1,%0" : "=r" (v) : "m" (*(u32 *)addr)); ++ asm volatile("movl %%gs:%1,%0" : "=r" (v) : "m" (*ptr)); + return v; + } + + static inline void wrgs8(u8 v, addr_t addr) + { +- asm volatile("movb %1,%%gs:%0" : "+m" (*(u8 *)addr) : "qi" (v)); ++ u8 *ptr = (u8 *)absolute_pointer(addr); ++ asm volatile("movb %1,%%gs:%0" : "+m" (*ptr) : "qi" (v)); + } + static inline void wrgs16(u16 v, addr_t addr) + { +- asm volatile("movw %1,%%gs:%0" : "+m" (*(u16 *)addr) : "ri" (v)); ++ u16 *ptr = (u16 *)absolute_pointer(addr); ++ asm volatile("movw %1,%%gs:%0" : "+m" (*ptr) : "ri" (v)); + } + static inline void wrgs32(u32 v, addr_t addr) + { +- asm volatile("movl %1,%%gs:%0" : "+m" (*(u32 *)addr) : "ri" (v)); ++ u32 *ptr = (u32 *)absolute_pointer(addr); ++ asm volatile("movl %1,%%gs:%0" : "+m" (*ptr) : "ri" (v)); + } + + /* Note: these only return true/false, not a signed return value! */ +--- a/arch/x86/boot/main.c ++++ b/arch/x86/boot/main.c +@@ -33,7 +33,7 @@ static void copy_boot_params(void) + u16 cl_offset; + }; + const struct old_cmdline * const oldcmd = +- (const struct old_cmdline *)OLD_CL_ADDRESS; ++ absolute_pointer(OLD_CL_ADDRESS); + + BUILD_BUG_ON(sizeof(boot_params) != 4096); + memcpy(&boot_params.hdr, &hdr, sizeof(hdr));