netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anders Roxell <anders.roxell@linaro.org>
To: "Björn Töpel" <bjorn@kernel.org>
Cc: "Andrii Nakryiko" <andrii@kernel.org>,
	"Mykola Lysenko" <mykolal@fb.com>,
	bpf@vger.kernel.org, "Daniel Borkmann" <daniel@iogearbox.net>,
	netdev@vger.kernel.org, "Björn Töpel" <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: Re: [PATCH bpf] selftests/bpf: Fix broken build where char is unsigned
Date: Thu, 2 Nov 2023 12:14:33 +0100	[thread overview]
Message-ID: <20231102111433.GA364395@mutt> (raw)
In-Reply-To: <20231102103537.247336-1-bjorn@kernel.org>

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
> 


  parent reply	other threads:[~2023-11-02 11:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-02 10:35 [PATCH bpf] selftests/bpf: Fix broken build where char is unsigned Björn Töpel
2023-11-02 10:49 ` Larysa Zaremba
2023-11-02 11:14 ` Anders Roxell [this message]
2023-11-02 15:00 ` patchwork-bot+netdevbpf

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=20231102111433.GA364395@mutt \
    --to=anders.roxell@linaro.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bjorn@kernel.org \
    --cc=bjorn@rivosinc.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=larysa.zaremba@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mykolal@fb.com \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).