Message ID | 20221105183656.86077-1-tegongkang@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1122082wru; Sat, 5 Nov 2022 11:37:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5MrVob9L2/U40mMmYrvREKh/d0HobtvMd3QWzfOt0TTgpwtADPwvAgKtfHBehBEbGW0x7D X-Received: by 2002:a63:950d:0:b0:46e:d655:b377 with SMTP id p13-20020a63950d000000b0046ed655b377mr36218491pgd.191.1667673467996; Sat, 05 Nov 2022 11:37:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667673467; cv=none; d=google.com; s=arc-20160816; b=gt7Hrkpw77YdvlGTzskIyRErHHYgA5mDXMzy81kn8PVFpn3vRybPDLlRatUqEZcZee w7brxb1IHjPRvKC4Z/Fxnnqr8rIUGVGz4vu5qaAPZC2pEaDomnrJ7puKyQM/KZlWUA3I peijC+ka5ra62xds3llwTQTryRvK/bqRUn/zHyscMtUFsN3zXofc0sRvIatuT8/FAYV2 gdNXNAD0UeFMKwWG8V3dWeFd02VqqMasYJS5NQzw7jZ8K/UhbI5emUVINbb+oCmgyKzb Qq1+XogPP5xTNiOjrdCcu4w4rvqN82K3tVz7uP0vvHSuqIWTciukfWsjXYW9hw4q0EVP 8tWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=iPvbXiS700b+lttA0LO5c0SaACzw4bdF9reHv5JUqaI=; b=s+IBp8OfZ9Gqw1c/SXxTBQK7VXgcW40Ofz6GxehEfpPTZavHWtUkiCKtxirXynLo4x /aECAy1X5w7xZ54r+9xh6FcOdDM6kMiiKQ0zr4ZUSJiWJfFQcMavbADL+Uu5GGDObCZz BlKzvfYFjySkAMNv679mQsxL5vK8Qxn2K2X9UECyEUkhBoFhwtvr997z+RXakK78igP0 eMWXeg++7Ak6/yatL2dLoUJPy0M9ogk575A7zU4ouVPALr1KZPzwOU29Bkn78C8cu8r8 A7eOt38v0i+C4U8oVne+D/99abVjkjKmK/4iuQPXv88H+jGsyJvOAodEECBfEaZ+KVbe xJgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XBeFqKPx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j20-20020aa78014000000b0056d7cc80e34si2993438pfi.102.2022.11.05.11.37.35; Sat, 05 Nov 2022 11:37:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XBeFqKPx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229865AbiKEShH (ORCPT <rfc822;hjfbswb@gmail.com> + 99 others); Sat, 5 Nov 2022 14:37:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229862AbiKEShF (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 5 Nov 2022 14:37:05 -0400 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8653211C3E; Sat, 5 Nov 2022 11:37:03 -0700 (PDT) Received: by mail-pg1-x52a.google.com with SMTP id v3so7041387pgh.4; Sat, 05 Nov 2022 11:37:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=iPvbXiS700b+lttA0LO5c0SaACzw4bdF9reHv5JUqaI=; b=XBeFqKPx1RZ4LegH+A3UpV5hpziCKC/DXyTxC1pytDYErWf3qx3a+n3DLxTJgvUNut QKfE42zxmbvcMAw1yYRfugE6VgNohsfHohojX2UJp2ZzEBEOY1bDKvPTmqXIpOo3IGak zNa1bUeAoV45BmSWQSz6gORQMNKdFqEI+SHgLUxXs232SuJrg9sRc4IV+0wyZRoe/N8+ T/hBVxyTPg4+YV+DHgkOd8aAe87d4tNQtS3SkuYINs4mBikKjlQNaVaEZ0h/WA8WXGco fijdVBD789Qn/oIdzOttuK/pPTGHoBw8VwmoXoWaseUOXAN+VWvKpP2JfYSrHlmJkBAG X+Lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=iPvbXiS700b+lttA0LO5c0SaACzw4bdF9reHv5JUqaI=; b=YhBAkFDXt3sTxnIsT3Seey1TDNaylwyIlg092IU7KdUt33vBCy8qZy8MCx8MFMfHYL A3JSwjOQOEBzdqbe09zMRk7C9BqqqiuPCLUZn/bQotXww7FX/BV2amZ95aaon0ftNW4Y NWoorEOQcy+xzaGum2piNhCDyefDeFoWqskYeZGqz9VV/CHixitTxSsIN5iTLuqtKXV8 1bd5VTEgc6l1i2X7JHn5xaR/SylQTUoySZW9Ql7bCMcCeINelw0Q2joCwGd8xuwCBFZa MGJ6rQj92+rMMvWbk3VkmhTmvRI2pO9ocR+O3pKTRHnD9KrnSInbtkfLvuFaPiNtpoln RDsw== X-Gm-Message-State: ACrzQf3V4y5yZwx9ikDsMZIQPJ2OP0SlETftyl7OfBiR72kaTPpgREs+ tmBSJGy/urAZA74GbbWZfW4= X-Received: by 2002:a05:6a00:d72:b0:56c:3c45:6953 with SMTP id n50-20020a056a000d7200b0056c3c456953mr41632260pfv.54.1667673422829; Sat, 05 Nov 2022 11:37:02 -0700 (PDT) Received: from uftrace.. ([14.5.161.231]) by smtp.gmail.com with ESMTPSA id y4-20020a17090322c400b0016f196209c9sm1987146plg.123.2022.11.05.11.37.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Nov 2022 11:37:02 -0700 (PDT) From: Kang Minchul <tegongkang@gmail.com> To: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= <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>, Randy Dunlap <rdunlap@infradead.org>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Kang Minchul <tegongkang@gmail.com> Subject: [PATCH v3] selftests/bpf: Fix u32 variable compared with less than zero Date: Sun, 6 Nov 2022 03:36:56 +0900 Message-Id: <20221105183656.86077-1-tegongkang@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748682374380313097?= X-GMAIL-MSGID: =?utf-8?q?1748682374380313097?= |
Series |
[v3] selftests/bpf: Fix u32 variable compared with less than zero
|
|
Commit Message
Kang Minchul
Nov. 5, 2022, 6:36 p.m. UTC
Variable ret is compared with less than zero even though it was set as u32.
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(-)
Comments
On 11/5/22 11:36, Kang Minchul wrote: > Variable ret is compared with less than zero even though it was set as u32. > So u32 to int conversion is needed. > > Signed-off-by: Kang Minchul <tegongkang@gmail.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> Thanks. > --- > 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) {
Kang Minchul <tegongkang@gmail.com> writes: > Variable ret is compared with less than zero even though it was set as u32. > So u32 to int conversion is needed. > > Signed-off-by: Kang Minchul <tegongkang@gmail.com> Acked-by: Björn Töpel <bjorn@kernel.org>
Hello: This patch was applied to bpf/bpf-next.git (master) by Martin KaFai Lau <martin.lau@kernel.org>: On Sun, 6 Nov 2022 03:36:56 +0900 you wrote: > Variable ret is compared with less than zero even though it was set as u32. > 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(-) Here is the summary with links: - [v3] selftests/bpf: Fix u32 variable compared with less than zero https://git.kernel.org/bpf/bpf-next/c/e8f50c4f0c14 You are awesome, thank you!
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) {