Re: [PATCH] net/ena: Fix build warning in ena_xdp_set()

From: David Miller
Date: Fri Apr 24 2020 - 19:53:07 EST


From: Gavin Shan <gshan@xxxxxxxxxx>
Date: Fri, 24 Apr 2020 10:01:46 +1000

> This fixes the following build warning in ena_xdp_set()
>
> In file included from ./include/net/inet_sock.h:19,
> from ./include/net/ip.h:27,
> from drivers/net/ethernet/amazon/ena/ena_netdev.c:46:
> drivers/net/ethernet/amazon/ena/ena_netdev.c: In function \
> ʽena_xdp_setʼ: \
> drivers/net/ethernet/amazon/ena/ena_netdev.c:557:6: warning: \
> format ʽ%luʼ \
> expects argument of type ʽlong unsigned intʼ, but argument 4 \
> has type ʽintʼ \
> [-Wformat=] "Failed to set xdp program, the current MTU (%d) is \
> larger than the maximum allowed MTU (%lu) while xdp is on",
>
> Signed-off-by: Gavin Shan <gshan@xxxxxxxxxx>

The type of the argument is configuration dependent, this is because
sometimes one of the terms to define ENA_XDP_MAX_MTU is PAGE_SIZE and
sometimes it is SZ_16K. And this determines whether it evaluates to
a long or not.

So your patch will just cause warnings in other configurations.

A better fix is therefore necessary.