netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcin Wojtas <mw@semihalf.com>
To: Nathan Chancellor <nathan@kernel.org>
Cc: Russell King <linux@armlinux.org.uk>,
	netdev <netdev@vger.kernel.org>,
	clang-built-linux@googlegroups.com
Subject: Re: -Wconstant-conversion in drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
Date: Thu, 29 Apr 2021 09:08:13 +0200	[thread overview]
Message-ID: <CAPv3WKeHcq+viBHR=ok+AytrNWLFudWJ8qHoShs3r4LOj7qD0w@mail.gmail.com> (raw)
In-Reply-To: <YImjw3eypUdhkp88@archlinux-ax161>

Hi Nathan,


śr., 28 kwi 2021 o 20:04 Nathan Chancellor <nathan@kernel.org> napisał(a):
>
> On Thu, Apr 16, 2020 at 05:41:20PM -0700, Nathan Chancellor wrote:
> > 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.
>
> Sorry for the necrobump, I am doing a bug scrub and it seems like this
> driver now has maintainers so keying them in in case they have any
> comments/suggestions.
>

Thank you for your interest. Are you still reproducing the issue? With
clang 10.0.0 the compilation passes in my setup:
$ ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make CC=clang
drivers/net/ethernet/marvell/mvpp2/
  SYNC    include/config/auto.conf.cmd
  CC      scripts/mod/empty.o
  MKELF   scripts/mod/elfconfig.h
  HOSTCC  scripts/mod/modpost.o
  CC      scripts/mod/devicetable-offsets.s
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/mod/sumversion.o
  HOSTLD  scripts/mod/modpost
  CC      kernel/bounds.s
  CC      arch/arm64/kernel/asm-offsets.s
  UPD     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CALL    scripts/atomic/check-atomics.sh
  LDS     arch/arm64/kernel/vdso/vdso.lds
  CC      arch/arm64/kernel/vdso/vgettimeofday.o
  AS      arch/arm64/kernel/vdso/note.o
  AS      arch/arm64/kernel/vdso/sigreturn.o
  LD      arch/arm64/kernel/vdso/vdso.so.dbg
  VDSOSYM include/generated/vdso-offsets.h
  OBJCOPY arch/arm64/kernel/vdso/vdso.so
  CC      drivers/net/ethernet/marvell/mvpp2/mvpp2_main.o
  CC      drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.o
  CC      drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.o
  CC      drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.o
  AR      drivers/net/ethernet/marvell/mvpp2/built-in.a

Best regards,
Marcin

  reply	other threads:[~2021-04-29  7:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2021-05-13  0:55     ` Nathan Chancellor

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='CAPv3WKeHcq+viBHR=ok+AytrNWLFudWJ8qHoShs3r4LOj7qD0w@mail.gmail.com' \
    --to=mw@semihalf.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=linux@armlinux.org.uk \
    --cc=nathan@kernel.org \
    --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).