Thread (3 messages) 3 messages, 1 author, 8d ago
DORMANTno replies

[PATCH net-next 1/2] nfc: llcp: widen getsockopt value locals to u32

From: Breno Leitao <leitao@debian.org>
Date: 2026-07-08 11:52:29
Also in: lkml, oe-linux-nfc
Subsystem: networking [general], nfc subsystem, the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, David Heidelberg, Linus Torvalds

nfc_llcp_getsockopt() returns each option as a u32 (written through a
(u32 __user *) cast), but the temporary variables are smaller than that,
and they are promoted at write side, example:

  u8 rw;
  put_user(rw, (u32 __user *) optval)

That is fine, but I want to widen the rw/miux/remote_miu locals from
u8/u16 to u32 so the following getsockopt_iter conversion can pass their
address to copy_to_iter(), which expects an object of the exact width.

No functional change.

PS: I am sending this as a separated patch to make sure this conversion
explictly reviewable.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 net/nfc/llcp_sock.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c
index 5558d8a4d48b3..94850fbe3620d 100644
--- a/net/nfc/llcp_sock.c
+++ b/net/nfc/llcp_sock.c
@@ -308,8 +308,7 @@ static int nfc_llcp_getsockopt(struct socket *sock, int level, int optname,
 	struct sock *sk = sock->sk;
 	struct nfc_llcp_sock *llcp_sock = nfc_llcp_sock(sk);
 	int len, err = 0;
-	u16 miux, remote_miu;
-	u8 rw;
+	u32 miux, remote_miu, rw;
 
 	pr_debug("%p optname %d\n", sk, optname);
 
-- 
2.53.0-Meta
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help