All of lore.kernel.org
 help / color / mirror / Atom feed
* -Wconstant-conversion in drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@ 2020-04-17  0:41 Nathan Chancellor
  2021-04-28 18:04 ` Nathan Chancellor
  0 siblings, 1 reply; 4+ messages in thread
From: Nathan Chancellor @ 2020-04-17  0:41 UTC (permalink / raw)
  To: netdev, clang-built-linux

Hi all,

I was building s390 allyesconfig with clang and came across a curious
warning:

drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c:580:41: warning:
implicit conversion from 'unsigned long' to 'int' changes value from
18446744073709551584 to -32 [-Wconstant-conversion]
        mvpp2_pools[MVPP2_BM_SHORT].pkt_size = MVPP2_BM_SHORT_PKT_SIZE;
                                             ~ ^~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/marvell/mvpp2/mvpp2.h:699:33: note: expanded from
macro 'MVPP2_BM_SHORT_PKT_SIZE'
#define MVPP2_BM_SHORT_PKT_SIZE MVPP2_RX_MAX_PKT_SIZE(MVPP2_BM_SHORT_FRAME_SIZE)
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/marvell/mvpp2/mvpp2.h:634:30: note: expanded from
macro 'MVPP2_RX_MAX_PKT_SIZE'
        ((total_size) - NET_SKB_PAD - MVPP2_SKB_SHINFO_SIZE)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

As far as I understand it, the warning comes from the fact that
MVPP2_BM_SHORT_FRAME_SIZE is treated as size_t because
MVPP2_SKB_SHINFO_SIZE ultimately calls ALIGN with sizeof(struct
skb_shared_info), which has typeof called on it.

The implicit conversion probably is fine but it would be nice to take
care of the warning. I am not sure what would be the best way to do that
would be though. An explicit cast would take care of it, maybe in
MVPP2_SKB_SHINFO_SIZE since the actual value I see is 320, which is able
to be fit into type int easily.

Any comments would be appreciated, there does not appear to be a
dedicated maintainer of this driver according to get_maintainer.pl.

Cheers,
Nathan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-13  0:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-17  0:41 -Wconstant-conversion in drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c Nathan Chancellor
2021-04-28 18:04 ` Nathan Chancellor
2021-04-29  7:08   ` Marcin Wojtas
2021-05-13  0:55     ` Nathan Chancellor

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.