Skip to content

Commit d84b139

Browse files
bjorn-rivosAlexei Starovoitov
authored andcommitted
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: bb6a888 ("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> Tested-by: Anders Roxell <anders.roxell@linaro.org> Link: https://lore.kernel.org/r/20231102103537.247336-1-bjorn@kernel.org Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent 94e88b8 commit d84b139

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/testing/selftests/bpf/xdp_hw_metadata.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ static void print_usage(void)
430430

431431
static void read_args(int argc, char *argv[])
432432
{
433-
char opt;
433+
int opt;
434434

435435
while ((opt = getopt(argc, argv, "mh")) != -1) {
436436
switch (opt) {

0 commit comments

Comments
 (0)