[rds-devel] [PATCH net] rds: Fix endian annotations across various assignments
Andrew Lunn
andrew at lunn.ch
Sun Aug 10 17:32:03 UTC 2025
On Sun, Aug 10, 2025 at 10:41:55PM +0530, Ujwal Kundur wrote:
> Sparse reports the following warnings:
>
> net/rds/af_rds.c:245:22: warning: invalid assignment: |=
> net/rds/af_rds.c:245:22: left side has type restricted __poll_t
> net/rds/af_rds.c:245:22: right side has type int
>
> __poll_t is typedef'ed to __bitwise while POLLERR is defined as 0x0008,
> force conversion.
Please could you split this up, one patch per type of problem.
> diff --git a/net/rds/af_rds.c b/net/rds/af_rds.c
> index 086a13170e09..9cd5905d916a 100644
> --- a/net/rds/af_rds.c
> +++ b/net/rds/af_rds.c
> @@ -242,7 +242,7 @@ static __poll_t rds_poll(struct file *file, struct socket *sock,
> if (rs->rs_snd_bytes < rds_sk_sndbuf(rs))
> mask |= (EPOLLOUT | EPOLLWRNORM);
> if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue))
> - mask |= POLLERR;
> + mask |= (__force __poll_t)POLLERR;
I don't like __force, it suggests something is wrong with the
design. If it is needed, it should be hidden away.
However:
~/linux/net$ grep -r POLLERR
caif/caif_socket.c: wake_up_interruptible_poll(sk_sleep(sk), EPOLLERR|EPOLLHUP);
caif/caif_socket.c: mask |= EPOLLERR;
rds/af_rds.c: mask |= POLLERR;
bluetooth/af_bluetooth.c: mask |= EPOLLERR |
sctp/socket.c: mask |= EPOLLERR |
vmw_vsock/af_vsock.c: mask |= EPOLLERR;
vmw_vsock/af_vsock.c: mask |= EPOLLERR;
vmw_vsock/af_vsock.c: mask |= EPOLLERR;
9p/trans_fd.c: return EPOLLERR;
9p/trans_fd.c: if (n & (EPOLLERR | EPOLLHUP | EPOLLNVAL)) {
mptcp/protocol.c: mask |= EPOLLERR;
core/datagram.c: if (key && !(key_to_poll(key) & (EPOLLIN | EPOLLERR)))
core/datagram.c: mask |= EPOLLERR |
core/sock.c: wake_up_interruptible_poll(&wq->wait, EPOLLERR);
nfc/llcp_sock.c: mask |= EPOLLERR |
smc/af_smc.c: else if (flags & EPOLLERR)
smc/af_smc.c: mask |= EPOLLERR;
phonet/socket.c: return EPOLLERR;
iucv/af_iucv.c: mask |= EPOLLERR |
unix/af_unix.c: mask |= EPOLLERR;
unix/af_unix.c: mask |= EPOLLERR |
ipv4/tcp.c: mask |= EPOLLERR;
sunrpc/rpc_pipe.c: mask |= EPOLLERR | EPOLLHUP;
atm/common.c: mask = EPOLLERR;
So why is af_rds.c special? Or do all these files also give the same
warning?
Also:
https://elixir.bootlin.com/linux/v6.16/source/include/uapi/linux/eventpoll.h#L34
#define EPOLLERR (__force __poll_t)0x00000008
So your patch does nothing.
Andrew
---
pw-bot: cr
More information about the rds-devel
mailing list