[PATCH net-next 1/2] nfc: llcp: widen getsockopt value locals to u32
Breno Leitao <[email protected]> Wed, 08 Jul 2026 04:51:58 -0700
| Newsgroups | dev.linux.lists.oe-linux-nfc,org.kernel.vger.linux-kernel,org.kernel.vger.netdev |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> --- 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