mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Ujwal Kundur <ujwal.kundur@gmail.com>
Cc: allison.henderson@oracle.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	horms@kernel.org, netdev@vger.kernel.org,
	linux-rdma@vger.kernel.org, rds-devel@oss.oracle.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] rds: Fix endian annotations across various assignments
Date: Sun, 10 Aug 2025 19:32:03 +0200	[thread overview]
Message-ID: <ac09739a-eec5-4025-989e-a6a202fcfd63@lunn.ch> (raw)
In-Reply-To: <20250810171155.3263-1-ujwal.kundur@gmail.com>

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

  reply	other threads:[~2025-08-10 17:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-10 17:11 Ujwal Kundur
2025-08-10 17:32 ` Andrew Lunn [this message]
2025-08-10 17:47 ` Al Viro
2025-08-10 18:25   ` Al Viro
2025-08-10 18:27     ` Al Viro
2025-08-10 18:41     ` Andrew Lunn
2025-08-10 19:26       ` Al Viro
2025-08-10 19:31       ` Ujwal Kundur
2025-08-10 20:19         ` Andrew Lunn
2025-08-10 21:00         ` Al Viro
2025-08-10 21:13           ` Al Viro
2025-08-10 18:38   ` Al Viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ac09739a-eec5-4025-989e-a6a202fcfd63@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=allison.henderson@oracle.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rds-devel@oss.oracle.com \
    --cc=ujwal.kundur@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®