From: Randy Dunlap <rdunlap@infradead.org>
To: "Kang Minchul" <tegongkang@gmail.com>,
"Björn Töpel" <bjorn@kernel.org>,
"Magnus Karlsson" <magnus.karlsson@intel.com>,
"Maciej Fijalkowski" <maciej.fijalkowski@intel.com>,
"Jonathan Lemon" <jonathan.lemon@gmail.com>
Cc: Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>, Yonghong Song <yhs@fb.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] selftests/bpf: Fix unsigned expression compared with zero
Date: Sat, 5 Nov 2022 09:16:31 -0700 [thread overview]
Message-ID: <e03209cb-00c7-e282-c2a6-9a2bab0b147f@infradead.org> (raw)
In-Reply-To: <20221105102552.80052-1-tegongkang@gmail.com>
Hi--
On 11/5/22 03:25, Kang Minchul wrote:
> Variable ret is compared with zero even though it was set as u32.
It's OK to compare a u32 == to zero, but 'ret' is compared to < 0,
which it cannot be. Better explanation here would be good.
Thanks.
> So u32 to int conversion is needed.
>
> Signed-off-by: Kang Minchul <tegongkang@gmail.com>
> ---
> tools/testing/selftests/bpf/xskxceiver.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c
> index 681a5db80dae..162d3a516f2c 100644
> --- a/tools/testing/selftests/bpf/xskxceiver.c
> +++ b/tools/testing/selftests/bpf/xskxceiver.c
> @@ -1006,7 +1006,8 @@ static int __send_pkts(struct ifobject *ifobject, u32 *pkt_nb, struct pollfd *fd
> {
> struct xsk_socket_info *xsk = ifobject->xsk;
> bool use_poll = ifobject->use_poll;
> - u32 i, idx = 0, ret, valid_pkts = 0;
> + u32 i, idx = 0, valid_pkts = 0;
> + int ret;
>
> while (xsk_ring_prod__reserve(&xsk->tx, BATCH_SIZE, &idx) < BATCH_SIZE) {
> if (use_poll) {
--
~Randy
next prev parent reply other threads:[~2022-11-05 16:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-05 10:25 Kang Minchul
2022-11-05 16:16 ` Randy Dunlap [this message]
2022-11-05 16:21 ` Kang Minchul
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=e03209cb-00c7-e282-c2a6-9a2bab0b147f@infradead.org \
--to=rdunlap@infradead.org \
--cc=bjorn@kernel.org \
--cc=jonathan.lemon@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maciej.fijalkowski@intel.com \
--cc=magnus.karlsson@intel.com \
--cc=martin.lau@linux.dev \
--cc=netdev@vger.kernel.org \
--cc=song@kernel.org \
--cc=tegongkang@gmail.com \
--cc=yhs@fb.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®