Skip to content

Commit 6b604b2

Browse files
committed
patches: Apply changes for -Wuninitialized change in clang-21
Signed-off-by: Nathan Chancellor <[email protected]>
1 parent 3158655 commit 6b604b2

File tree

56 files changed

+3728
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+3728
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
From a87fdd235388e0c6644305eda55f265ff2c04f84 Mon Sep 17 00:00:00 2001
2+
From: Nathan Chancellor <[email protected]>
3+
Date: Fri, 1 Aug 2025 15:30:21 -0700
4+
Subject: [PATCH] HACK: rtl8712: Zero initialize val in read_rfreg_hdl()
5+
6+
This is likely not a correct fix. This driver was removed in 6.13 in
7+
commit 41e883c137eb ("staging: rtl8712: Remove driver using deprecated
8+
API wext"), so this will need to be a stable only fix.
9+
---
10+
drivers/staging/rtl8712/rtl8712_cmd.c | 2 +-
11+
1 file changed, 1 insertion(+), 1 deletion(-)
12+
13+
diff --git a/drivers/staging/rtl8712/rtl8712_cmd.c b/drivers/staging/rtl8712/rtl8712_cmd.c
14+
index bb7db96ed821..6e2d92f7b22e 100644
15+
--- a/drivers/staging/rtl8712/rtl8712_cmd.c
16+
+++ b/drivers/staging/rtl8712/rtl8712_cmd.c
17+
@@ -140,7 +140,7 @@ static u8 write_bbreg_hdl(struct _adapter *padapter, u8 *pbuf)
18+
19+
static u8 read_rfreg_hdl(struct _adapter *padapter, u8 *pbuf)
20+
{
21+
- u32 val;
22+
+ u32 val = 0;
23+
void (*pcmd_callback)(struct _adapter *dev, struct cmd_obj *pcmd);
24+
struct cmd_obj *pcmd = (struct cmd_obj *)pbuf;
25+
26+
--
27+
2.50.1
28+
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
From 17ba793f381eb813596d6de1cc6820bcbda5ed8b Mon Sep 17 00:00:00 2001
2+
From: Nathan Chancellor <[email protected]>
3+
Date: Tue, 15 Jul 2025 16:15:40 -0700
4+
Subject: phonet/pep: Move call to pn_skb_get_dst_sockaddr() earlier in
5+
pep_sock_accept()
6+
7+
A new warning in clang [1] points out a place in pep_sock_accept() where
8+
dst is uninitialized then passed as a const pointer to pep_find_pipe():
9+
10+
net/phonet/pep.c:829:37: error: variable 'dst' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]
11+
829 | newsk = pep_find_pipe(&pn->hlist, &dst, pipe_handle);
12+
| ^~~:
13+
14+
Move the call to pn_skb_get_dst_sockaddr(), which initializes dst, to
15+
before the call to pep_find_pipe(), so that dst is consistently used
16+
initialized throughout the function.
17+
18+
19+
Fixes: f7ae8d59f661 ("Phonet: allocate sock from accept syscall rather than soft IRQ")
20+
Link: https://github.com/llvm/llvm-project/commit/00dacf8c22f065cb52efb14cd091d441f19b319e [1]
21+
Closes: https://github.com/ClangBuiltLinux/linux/issues/2101
22+
Signed-off-by: Nathan Chancellor <[email protected]>
23+
Link: https://patch.msgid.link/20250715-net-phonet-fix-uninit-const-pointer-v1-1-8efd1bd188b3@kernel.org
24+
Signed-off-by: Jakub Kicinski <[email protected]>
25+
---
26+
Link: https://git.kernel.org/linus/17ba793f381eb813596d6de1cc6820bcbda5ed8b
27+
---
28+
net/phonet/pep.c | 2 +-
29+
1 file changed, 1 insertion(+), 1 deletion(-)
30+
31+
diff --git a/net/phonet/pep.c b/net/phonet/pep.c
32+
index 53a858478e22f0..62527e1ebb883d 100644
33+
--- a/net/phonet/pep.c
34+
+++ b/net/phonet/pep.c
35+
@@ -826,6 +826,7 @@ static struct sock *pep_sock_accept(struct sock *sk,
36+
}
37+
38+
/* Check for duplicate pipe handle */
39+
+ pn_skb_get_dst_sockaddr(skb, &dst);
40+
newsk = pep_find_pipe(&pn->hlist, &dst, pipe_handle);
41+
if (unlikely(newsk)) {
42+
__sock_put(newsk);
43+
@@ -850,7 +851,6 @@ static struct sock *pep_sock_accept(struct sock *sk,
44+
newsk->sk_destruct = pipe_destruct;
45+
46+
newpn = pep_sk(newsk);
47+
- pn_skb_get_dst_sockaddr(skb, &dst);
48+
pn_skb_get_src_sockaddr(skb, &src);
49+
newpn->pn_sk.sobject = pn_sockaddr_get_object(&dst);
50+
newpn->pn_sk.dobject = pn_sockaddr_get_object(&src);
51+
--
52+
cgit 1.2.3-korg
53+
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
From git@z Thu Jan 1 00:00:00 1970
2+
Subject: [PATCH] KVM: arm64: sys_regs: disable
3+
-Wuninitialized-const-pointer warning
4+
From: Justin Stitt <[email protected]>
5+
Date: Mon, 28 Jul 2025 14:04:24 -0700
6+
Message-Id: <20250728-b4-stable-disable-uninit-ptr-warn-5-15-v1-1-e373a895b9c5@google.com>
7+
MIME-Version: 1.0
8+
Content-Type: text/plain; charset="utf-8"
9+
Content-Transfer-Encoding: 7bit
10+
11+
A new warning in Clang 22 [1] complains that @clidr passed to
12+
get_clidr_el1() is an uninitialized const pointer. get_clidr_el1()
13+
doesn't really care since it casts away the const-ness anyways -- it is
14+
a false positive.
15+
16+
| ../arch/arm64/kvm/sys_regs.c:2838:23: warning: variable 'clidr' is uninitialized when passed as a const pointer argument here [-Wuninitialized-const-pointer]
17+
| 2838 | get_clidr_el1(NULL, &clidr); /* Ugly... */
18+
| | ^~~~~
19+
20+
Disable this warning for sys_regs.o with an iron fist as it doesn't make
21+
sense to waste maintainer's time or potentially break builds by
22+
backporting large changelists from 6.2+.
23+
24+
This patch isn't needed for anything past 6.1 as this code section was
25+
reworked in Commit 7af0c2534f4c ("KVM: arm64: Normalize cache
26+
configuration").
27+
28+
29+
Fixes: 7c8c5e6a9101e ("arm64: KVM: system register handling")
30+
Link: https://github.com/llvm/llvm-project/commit/00dacf8c22f065cb52efb14cd091d441f19b319e [1]
31+
Signed-off-by: Justin Stitt <[email protected]>
32+
Link: https://lore.kernel.org/r/20250728-b4-stable-disable-uninit-ptr-warn-5-15-v1-1-e373a895b9c5@google.com
33+
---
34+
I'm sending a similar patch for 6.1.
35+
---
36+
arch/arm64/kvm/Makefile | 3 +++
37+
1 file changed, 3 insertions(+)
38+
39+
diff --git a/arch/arm64/kvm/Makefile b/arch/arm64/kvm/Makefile
40+
index 989bb5dad2c8..109cca425d3e 100644
41+
--- a/arch/arm64/kvm/Makefile
42+
+++ b/arch/arm64/kvm/Makefile
43+
@@ -25,3 +25,6 @@ kvm-y := $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o $(KVM)/eventfd.o \
44+
vgic/vgic-its.o vgic/vgic-debug.o
45+
46+
kvm-$(CONFIG_HW_PERF_EVENTS) += pmu-emul.o
47+
+
48+
+# Work around a false positive Clang 22 -Wuninitialized-const-pointer warning
49+
+CFLAGS_sys_regs.o := $(call cc-disable-warning, uninitialized-const-pointer)
50+
51+
---
52+
base-commit: 8bb7eca972ad531c9b149c0a51ab43a417385813
53+
change-id: 20250728-b4-stable-disable-uninit-ptr-warn-5-15-c0c9db3df206
54+
55+
Best regards,
56+
--
57+
Justin Stitt <[email protected]>
58+
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
From 21b34a3a204ed616373a12ec17dc127ebe51eab3 Mon Sep 17 00:00:00 2001
2+
From: Nathan Chancellor <[email protected]>
3+
Date: Tue, 15 Jul 2025 15:56:05 -0700
4+
Subject: memstick: core: Zero initialize id_reg in h_memstick_read_dev_id()
5+
6+
A new warning in clang [1] points out that id_reg is uninitialized then
7+
passed to memstick_init_req() as a const pointer:
8+
9+
drivers/memstick/core/memstick.c:330:59: error: variable 'id_reg' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]
10+
330 | memstick_init_req(&card->current_mrq, MS_TPC_READ_REG, &id_reg,
11+
| ^~~~~~
12+
13+
Commit de182cc8e882 ("drivers/memstick/core/memstick.c: avoid -Wnonnull
14+
warning") intentionally passed this variable uninitialized to avoid an
15+
-Wnonnull warning from a NULL value that was previously there because
16+
id_reg is never read from the call to memstick_init_req() in
17+
h_memstick_read_dev_id(). Just zero initialize id_reg to avoid the
18+
warning, which is likely happening in the majority of builds using
19+
modern compilers that support '-ftrivial-auto-var-init=zero'.
20+
21+
22+
Fixes: de182cc8e882 ("drivers/memstick/core/memstick.c: avoid -Wnonnull warning")
23+
Link: https://github.com/llvm/llvm-project/commit/00dacf8c22f065cb52efb14cd091d441f19b319e [1]
24+
Closes: https://github.com/ClangBuiltLinux/linux/issues/2105
25+
Signed-off-by: Nathan Chancellor <[email protected]>
26+
Link: https://lore.kernel.org/r/20250715-memstick-fix-uninit-const-pointer-v1-1-f6753829c27a@kernel.org
27+
Signed-off-by: Ulf Hansson <[email protected]>
28+
---
29+
Link: https://git.kernel.org/linus/21b34a3a204ed616373a12ec17dc127ebe51eab3
30+
---
31+
drivers/memstick/core/memstick.c | 2 +-
32+
1 file changed, 1 insertion(+), 1 deletion(-)
33+
34+
diff --git a/drivers/memstick/core/memstick.c b/drivers/memstick/core/memstick.c
35+
index 043b9ec756ff27..7f3f47db4c98a5 100644
36+
--- a/drivers/memstick/core/memstick.c
37+
+++ b/drivers/memstick/core/memstick.c
38+
@@ -324,7 +324,7 @@ EXPORT_SYMBOL(memstick_init_req);
39+
static int h_memstick_read_dev_id(struct memstick_dev *card,
40+
struct memstick_request **mrq)
41+
{
42+
- struct ms_id_register id_reg;
43+
+ struct ms_id_register id_reg = {};
44+
45+
if (!(*mrq)) {
46+
memstick_init_req(&card->current_mrq, MS_TPC_READ_REG, &id_reg,
47+
--
48+
cgit 1.2.3-korg
49+
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
From 5b1e38c0792cc7a44997328de37d393f81b2501a Mon Sep 17 00:00:00 2001
2+
From: Robert-Ionut Alexa <[email protected]>
3+
Date: Thu, 6 Jan 2022 15:59:03 +0200
4+
Subject: dpaa2-mac: bail if the dpmacs fwnode is not found
5+
6+
The parent pointer node handler must be declared with a NULL
7+
initializer. Before using it, a check must be performed to make
8+
sure that a valid address has been assigned to it.
9+
10+
Signed-off-by: Robert-Ionut Alexa <[email protected]>
11+
Signed-off-by: Jakub Kicinski <[email protected]>
12+
---
13+
Link: https://git.kernel.org/linus/5b1e38c0792cc7a44997328de37d393f81b2501a
14+
---
15+
drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c | 5 ++++-
16+
1 file changed, 4 insertions(+), 1 deletion(-)
17+
18+
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
19+
index 7f509f427e3d6d..e80376c6e55e38 100644
20+
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
21+
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
22+
@@ -41,7 +41,7 @@ static int phy_mode(enum dpmac_eth_if eth_if, phy_interface_t *if_mode)
23+
static struct fwnode_handle *dpaa2_mac_get_node(struct device *dev,
24+
u16 dpmac_id)
25+
{
26+
- struct fwnode_handle *fwnode, *parent, *child = NULL;
27+
+ struct fwnode_handle *fwnode, *parent = NULL, *child = NULL;
28+
struct device_node *dpmacs = NULL;
29+
int err;
30+
u32 id;
31+
@@ -56,6 +56,9 @@ static struct fwnode_handle *dpaa2_mac_get_node(struct device *dev,
32+
parent = fwnode;
33+
}
34+
35+
+ if (!parent)
36+
+ return NULL;
37+
+
38+
fwnode_for_each_child_node(parent, child) {
39+
err = -EINVAL;
40+
if (is_acpi_device_node(child))
41+
--
42+
cgit 1.2.3-korg
43+
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
From 81284e86bf8849f8e98e8ead3ff5811926b2107f Mon Sep 17 00:00:00 2001
2+
From: Nathan Chancellor <[email protected]>
3+
Date: Tue, 15 Jul 2025 19:45:23 -0700
4+
Subject: wifi: brcmsmac: Remove const from tbl_ptr parameter in
5+
wlc_lcnphy_common_read_table()
6+
7+
A new warning in clang [1] complains that diq_start in
8+
wlc_lcnphy_tx_iqlo_cal() is passed uninitialized as a const pointer to
9+
wlc_lcnphy_common_read_table():
10+
11+
drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c:2728:13: error: variable 'diq_start' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]
12+
2728 | &diq_start, 1, 16, 69);
13+
| ^~~~~~~~~
14+
15+
The table pointer passed to wlc_lcnphy_common_read_table() should not be
16+
considered constant, as wlc_phy_read_table() is ultimately going to
17+
update it. Remove the const qualifier from the tbl_ptr to clear up the
18+
warning.
19+
20+
21+
Closes: https://github.com/ClangBuiltLinux/linux/issues/2108
22+
Fixes: 5b435de0d786 ("net: wireless: add brcm80211 drivers")
23+
Link: https://github.com/llvm/llvm-project/commit/00dacf8c22f065cb52efb14cd091d441f19b319e [1]
24+
Signed-off-by: Nathan Chancellor <[email protected]>
25+
Acked-by: Arend van Spriel <[email protected]>>
26+
Link: https://patch.msgid.link/20250715-brcmsmac-fix-uninit-const-pointer-v1-1-16e6a51a8ef4@kernel.org
27+
Signed-off-by: Johannes Berg <[email protected]>
28+
---
29+
Link: https://git.kernel.org/linus/81284e86bf8849f8e98e8ead3ff5811926b2107f
30+
---
31+
drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c | 2 +-
32+
1 file changed, 1 insertion(+), 1 deletion(-)
33+
34+
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c
35+
index d0faba24056105..b4bba67a45ec36 100644
36+
--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c
37+
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c
38+
@@ -919,7 +919,7 @@ void wlc_lcnphy_read_table(struct brcms_phy *pi, struct phytbl_info *pti)
39+
40+
static void
41+
wlc_lcnphy_common_read_table(struct brcms_phy *pi, u32 tbl_id,
42+
- const u16 *tbl_ptr, u32 tbl_len,
43+
+ u16 *tbl_ptr, u32 tbl_len,
44+
u32 tbl_width, u32 tbl_offset)
45+
{
46+
struct phytbl_info tab;
47+
--
48+
cgit 1.2.3-korg
49+

0 commit comments

Comments
 (0)