Commit d84b139f authored by Björn Töpel's avatar Björn Töpel Committed by Alexei Starovoitov

selftests/bpf: Fix broken build where char is unsigned

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: bb6a8888 ("selftests/bpf: Add options and frags to xdp_hw_metadata")
Signed-off-by: default avatarBjörn Töpel <bjorn@rivosinc.com>
Acked-by: default avatarLarysa Zaremba <larysa.zaremba@intel.com>
Tested-by: default avatarAnders Roxell <anders.roxell@linaro.org>
Link: https://lore.kernel.org/r/20231102103537.247336-1-bjorn@kernel.orgSigned-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 94e88b8a
......@@ -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) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment