public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: "dust.li" <dust.li@linux•alibaba.com>
To: Jakub Kicinski <kuba@kernel•org>, davem@davemloft•net
Cc: netdev@vger•kernel.org
Subject: Re: [PATCH net-next] net: smc: fix different types in min()
Date: Wed, 2 Mar 2022 09:44:01 +0800	[thread overview]
Message-ID: <20220302014401.GB9417@linux.alibaba.com> (raw)
In-Reply-To: <20220301222446.1271127-1-kuba@kernel.org>

On Tue, Mar 01, 2022 at 02:24:46PM -0800, Jakub Kicinski wrote:
>Fix build:
>
> include/linux/minmax.h:45:25: note: in expansion of macro ‘__careful_cmp’
>   45 | #define min(x, y)       __careful_cmp(x, y, <)
>      |                         ^~~~~~~~~~~~~
> net/smc/smc_tx.c:150:24: note: in expansion of macro ‘min’
>  150 |         corking_size = min(sock_net(&smc->sk)->smc.sysctl_autocorking_size,
>      |                        ^~~

Really sorry for the break and thanks for the fix !
I found my compiler didn't complain about this, I will try to fix my
development environment.

>
>Fixes: 12bbb0d163a9 ("net/smc: add sysctl for autocorking")
>Signed-off-by: Jakub Kicinski <kuba@kernel•org>
>---
> net/smc/smc_tx.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/net/smc/smc_tx.c b/net/smc/smc_tx.c
>index 257dc0d0aeb1..98ca9229fe87 100644
>--- a/net/smc/smc_tx.c
>+++ b/net/smc/smc_tx.c
>@@ -147,8 +147,8 @@ static bool smc_should_autocork(struct smc_sock *smc)
> 	struct smc_connection *conn = &smc->conn;
> 	int corking_size;
> 
>-	corking_size = min(sock_net(&smc->sk)->smc.sysctl_autocorking_size,
>-			   conn->sndbuf_desc->len >> 1);
>+	corking_size = min_t(unsigned int, conn->sndbuf_desc->len >> 1,
>+			     sock_net(&smc->sk)->smc.sysctl_autocorking_size);
> 
> 	if (atomic_read(&conn->cdc_pend_tx_wr) == 0 ||
> 	    smc_tx_prepared_sends(conn) > corking_size)
>-- 
>2.34.1

      parent reply	other threads:[~2022-03-02  1:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-01 22:24 [PATCH net-next] net: smc: fix different types in min() Jakub Kicinski
2022-03-02  0:50 ` patchwork-bot+netdevbpf
2022-03-02  1:44 ` dust.li [this message]

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=20220302014401.GB9417@linux.alibaba.com \
    --to=dust.li@linux$(echo .)alibaba.com \
    --cc=davem@davemloft$(echo .)net \
    --cc=kuba@kernel$(echo .)org \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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