Message ID | 20231102103537.247336-1-bjorn@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp256506vqu; Thu, 2 Nov 2023 03:36:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHlIXndhQfFRZI9p06mD9b/rcGt4eYScdLIhH4Ohq66EPX+4jCEfjzZpy1uIw895AL34GB7 X-Received: by 2002:a05:6a20:918d:b0:13f:1622:29de with SMTP id v13-20020a056a20918d00b0013f162229demr17478718pzd.7.1698921383469; Thu, 02 Nov 2023 03:36:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698921383; cv=none; d=google.com; s=arc-20160816; b=BUaZcIVYqk+fHFYEUtmGpix9trx5NgrZcuLXXvs+xFxTXNR1c9Jo9qYAO0Opdn1R61 hT5KreBINeIKCo9m+GZKxa+Bc+0SV+YzPhwI5NDNkP0ntT/6BOW5vMPrMSg5j/22HS3v EPprAnSgblAbcjx26JowrnGxte7Rm/bI0VLbjLdHncoEqvMiWFXqzx+z0IGPYR+XrRsB sEdSsHXAKA/hU2rbTreKVWVxpE5K1V4TDrQxzFqTkTOs91EglUvFxdeJKMkIh30szuNy +rqeJSGgmyV5Wvj4sP4f+EXdGiq1i1jeUujrLw6tlZwxvafIExPWwlR5KafgK0RpuBxY dA9A== 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=ZV6L7qFahrkLoodGPchbWR/JmgzeTU1O/hnOkdcGN5c=; fh=1lOSW4nCXJDZtJbe+vtgUuJuzXsy4Mf7lMhH92gBTYU=; b=ZuddCqK1v8MjD+deSWap3xMjjlC29AOsMvg69on1SeNBvzlza0Gb7E2vJauy3IqKeG cS8VqvyDr96ztMEYfiJVTpVvrD24dHwE2ugZRpZQOEQNUQaG290cOyIrmKBnpdewtaPr Bdi3zx3AOYLItmwHLmJw9nzKRsgLIBjB0/8OIVqvWcvu/K1FBJ8hNexKFCuazzKtQywD h6ym2cwI8ST9M8InxM+zbr+Z+dW+xObpLAS3YyZ/e0dvrzp91+r7lJsmVJ09funl4M5Q 1SpPruE3ADazrtrRnEK81kN9CqFKjrlTwrdLsJ9eWkb51p48gnASqThBq/LfD7ogDqGE 6gJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="hp/SNoSV"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id fj32-20020a056a003a2000b0068e2d888713si3497914pfb.167.2023.11.02.03.36.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 03:36:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="hp/SNoSV"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id C1B6980689E0; Thu, 2 Nov 2023 03:36:20 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347107AbjKBKfr (ORCPT <rfc822;lhua1029@gmail.com> + 36 others); Thu, 2 Nov 2023 06:35:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346324AbjKBKfp (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 2 Nov 2023 06:35:45 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57FE0131; Thu, 2 Nov 2023 03:35:43 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3ABAC433C9; Thu, 2 Nov 2023 10:35:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698921343; bh=1nnK+BgW97TZtPhAGFwIN2pVL9Lwel3zDlxOeK1GZE0=; h=From:To:Cc:Subject:Date:From; b=hp/SNoSVOXUm2gBmEt7NCjTtCofg8ToWbsBifF9Kd3r4tUtWuioL9hwqtS+CbRTM5 +44EtvxUoltEK16bErmJlLfv13KoegLIHu+lWMDkJ05A1Z6Mplzq2NQR4UT28EmkuJ 3MN01IJD4ycpIjkpqCnSteIwuhTNqZRYX3zkWFu2xIXocS9tou+zuQi6NhDqUBujgM vebm2NL3NQbQJHibw5K1q8LchYPPPfc7KHfsBd98HyiU2YPYViZozcW3OR0nZilgu7 rXFs7ypd5omEGDhwVRfZkmXb8+llmhTOMLF/3CaanKJUmmk7P9voV0An2U9BjbsVk2 05su5Veo2NFGg== From: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= <bjorn@kernel.org> To: Andrii Nakryiko <andrii@kernel.org>, Mykola Lysenko <mykolal@fb.com>, bpf@vger.kernel.org, Daniel Borkmann <daniel@iogearbox.net>, netdev@vger.kernel.org Cc: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= <bjorn@rivosinc.com>, Alexei Starovoitov <ast@kernel.org>, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Larysa Zaremba <larysa.zaremba@intel.com> Subject: [PATCH bpf] selftests/bpf: Fix broken build where char is unsigned Date: Thu, 2 Nov 2023 11:35:37 +0100 Message-Id: <20231102103537.247336-1-bjorn@kernel.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 02 Nov 2023 03:36:20 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781448188613284086 X-GMAIL-MSGID: 1781448188613284086 |
Series |
[bpf] selftests/bpf: Fix broken build where char is unsigned
|
|
Commit Message
Björn Töpel
Nov. 2, 2023, 10:35 a.m. UTC
From: Björn Töpel <bjorn@rivosinc.com> There are architectures where char is not signed. If so, the following error is triggered: | xdp_hw_metadata.c:435:42: error: result of comparison of constant -1 \ | with expression of type 'char' is always true \ | [-Werror,-Wtautological-constant-out-of-range-compare] | 435 | while ((opt = getopt(argc, argv, "mh")) != -1) { | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~ | 1 error generated. Correct by changing the char to int. Fixes: bb6a88885fde ("selftests/bpf: Add options and frags to xdp_hw_metadata") Signed-off-by: Björn Töpel <bjorn@rivosinc.com> --- tools/testing/selftests/bpf/xdp_hw_metadata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) base-commit: cb3c6a58be50c65014296aa3455cae0fa1e82eac
Comments
On Thu, Nov 02, 2023 at 11:35:37AM +0100, Björn Töpel wrote: > From: Björn Töpel <bjorn@rivosinc.com> > > There are architectures where char is not signed. If so, the following > error is triggered: > > | xdp_hw_metadata.c:435:42: error: result of comparison of constant -1 \ > | with expression of type 'char' is always true \ > | [-Werror,-Wtautological-constant-out-of-range-compare] > | 435 | while ((opt = getopt(argc, argv, "mh")) != -1) { > | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~ > | 1 error generated. > > Correct by changing the char to int. > > Fixes: bb6a88885fde ("selftests/bpf: Add options and frags to xdp_hw_metadata") > Signed-off-by: Björn Töpel <bjorn@rivosinc.com> Acked-by: Larysa Zaremba <larysa.zaremba@intel.com> > --- > tools/testing/selftests/bpf/xdp_hw_metadata.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/bpf/xdp_hw_metadata.c b/tools/testing/selftests/bpf/xdp_hw_metadata.c > index 17c0f92ff160..c3ba40d0b9de 100644 > --- a/tools/testing/selftests/bpf/xdp_hw_metadata.c > +++ b/tools/testing/selftests/bpf/xdp_hw_metadata.c > @@ -430,7 +430,7 @@ static void print_usage(void) > > static void read_args(int argc, char *argv[]) > { > - char opt; > + int opt; > > while ((opt = getopt(argc, argv, "mh")) != -1) { > switch (opt) { > > base-commit: cb3c6a58be50c65014296aa3455cae0fa1e82eac > -- > 2.40.1 > >
On 2023-11-02 11:35, Björn Töpel wrote: > From: Björn Töpel <bjorn@rivosinc.com> > > There are architectures where char is not signed. If so, the following > error is triggered: > > | xdp_hw_metadata.c:435:42: error: result of comparison of constant -1 \ > | with expression of type 'char' is always true \ > | [-Werror,-Wtautological-constant-out-of-range-compare] > | 435 | while ((opt = getopt(argc, argv, "mh")) != -1) { > | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~ > | 1 error generated. > > Correct by changing the char to int. > > Fixes: bb6a88885fde ("selftests/bpf: Add options and frags to xdp_hw_metadata") > Signed-off-by: Björn Töpel <bjorn@rivosinc.com> Thank you for the patch. I saw the same failure when I built selftests/bpf for arm64. With this patch ontop of today's next-20231102, fixes that build issue. Tested-by: Anders Roxell <anders.roxell@linaro.org> Cheers, Anders > --- > tools/testing/selftests/bpf/xdp_hw_metadata.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/bpf/xdp_hw_metadata.c b/tools/testing/selftests/bpf/xdp_hw_metadata.c > index 17c0f92ff160..c3ba40d0b9de 100644 > --- a/tools/testing/selftests/bpf/xdp_hw_metadata.c > +++ b/tools/testing/selftests/bpf/xdp_hw_metadata.c > @@ -430,7 +430,7 @@ static void print_usage(void) > > static void read_args(int argc, char *argv[]) > { > - char opt; > + int opt; > > while ((opt = getopt(argc, argv, "mh")) != -1) { > switch (opt) { > > base-commit: cb3c6a58be50c65014296aa3455cae0fa1e82eac > -- > 2.40.1 >
Hello: This patch was applied to bpf/bpf.git (master) by Alexei Starovoitov <ast@kernel.org>: On Thu, 2 Nov 2023 11:35:37 +0100 you wrote: > From: Björn Töpel <bjorn@rivosinc.com> > > There are architectures where char is not signed. If so, the following > error is triggered: > > | xdp_hw_metadata.c:435:42: error: result of comparison of constant -1 \ > | with expression of type 'char' is always true \ > | [-Werror,-Wtautological-constant-out-of-range-compare] > | 435 | while ((opt = getopt(argc, argv, "mh")) != -1) { > | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~ > | 1 error generated. > > [...] Here is the summary with links: - [bpf] selftests/bpf: Fix broken build where char is unsigned https://git.kernel.org/bpf/bpf/c/d84b139f53e8 You are awesome, thank you!
diff --git a/tools/testing/selftests/bpf/xdp_hw_metadata.c b/tools/testing/selftests/bpf/xdp_hw_metadata.c index 17c0f92ff160..c3ba40d0b9de 100644 --- a/tools/testing/selftests/bpf/xdp_hw_metadata.c +++ b/tools/testing/selftests/bpf/xdp_hw_metadata.c @@ -430,7 +430,7 @@ static void print_usage(void) static void read_args(int argc, char *argv[]) { - char opt; + int opt; while ((opt = getopt(argc, argv, "mh")) != -1) { switch (opt) {