lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdU+O+hz9ja18cFkmwtz+AfEXJHz7N5Hx0S9aw+zD9wkEQ@mail.gmail.com>
Date:   Tue, 25 Oct 2022 08:48:07 +0200
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>
Cc:     kernel test robot <lkp@...el.com>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "edumazet@...gle.com" <edumazet@...gle.com>,
        "kuba@...nel.org" <kuba@...nel.org>,
        "pabeni@...hat.com" <pabeni@...hat.com>,
        "robh+dt@...nel.org" <robh+dt@...nel.org>,
        "krzysztof.kozlowski+dt@...aro.org" 
        <krzysztof.kozlowski+dt@...aro.org>,
        "kbuild-all@...ts.01.org" <kbuild-all@...ts.01.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        "linux-renesas-soc@...r.kernel.org" 
        <linux-renesas-soc@...r.kernel.org>
Subject: Re: [PATCH v4 2/3] net: ethernet: renesas: Add Ethernet Switch driver

Hi Shimoda-san,

On Tue, Oct 25, 2022 at 6:39 AM Yoshihiro Shimoda
<yoshihiro.shimoda.uh@...esas.com> wrote:
> > From: Geert Uytterhoeven, Sent: Tuesday, October 25, 2022 12:28 AM
> > To: kernel test robot <lkp@...el.com>
> > Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>; davem@...emloft.net; edumazet@...gle.com; kuba@...nel.org;
> > pabeni@...hat.com; robh+dt@...nel.org; krzysztof.kozlowski+dt@...aro.org; kbuild-all@...ts.01.org;
> > netdev@...r.kernel.org; devicetree@...r.kernel.org; linux-renesas-soc@...r.kernel.org
> > Subject: Re: [PATCH v4 2/3] net: ethernet: renesas: Add Ethernet Switch driver
> >
> > On Wed, Oct 19, 2022 at 1:17 PM kernel test robot <lkp@...el.com> wrote:
> > > I love your patch! Perhaps something to improve:
> > >
> > > [auto build test WARNING on net-next/master]
> > > [also build test WARNING on net/master robh/for-next linus/master v6.1-rc1 next-20221019]
> > > [If your patch is applied to the wrong git tree, kindly drop us a note.
> > > And when submitting patch, we suggest to use '--base' as documented in
> > >
> <snip>
> > >         git checkout f310f8cc37dfb090cfb06ae38530276327569464
> > >         # save the config file
> > >         mkdir build_dir && cp config build_dir/.config
> > >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash
> > drivers/net/
> > >
> > > If you fix the issue, kindly add following tag where applicable
> > > | Reported-by: kernel test robot <lkp@...el.com>
> > >
> > > All warnings (new ones prefixed by >>):
> > >
> > >    drivers/net/ethernet/renesas/rswitch.c: In function 'rswitch_ext_desc_get_dptr':
> > > >> drivers/net/ethernet/renesas/rswitch.c:355:71: warning: left shift count >= width of type [-Wshift-count-overflow]
> > >      355 |         return __le32_to_cpu(desc->dptrl) | (dma_addr_t)(desc->dptrh) << 32;
> > >          |                                                                       ^~
> > >    drivers/net/ethernet/renesas/rswitch.c: In function 'rswitch_ext_ts_desc_get_dptr':
> > >    drivers/net/ethernet/renesas/rswitch.c:367:71: warning: left shift count >= width of type [-Wshift-count-overflow]
> > >      367 |         return __le32_to_cpu(desc->dptrl) | (dma_addr_t)(desc->dptrh) << 32;
> > >          |                                                                       ^~
> > >
> > >
> > > vim +355 drivers/net/ethernet/renesas/rswitch.c
> > >
> > >    352
> > >    353  static dma_addr_t rswitch_ext_desc_get_dptr(struct rswitch_ext_desc *desc)
> > >    354  {
> > >  > 355          return __le32_to_cpu(desc->dptrl) | (dma_addr_t)(desc->dptrh) << 32;
> >
> > A simple fix would be to replace the cast to "dma_addr_t" by a cast to "u64".

> I got it. I'll fix this by a cast to "u64".
>
> > BTW, if struct rswitch_ext_desc would just extend struct rswitch_desc,
> > you could use rswitch_ext_desc_get_dptr() for both.
>
> Yes, all rswitch_xxx_desc just extend struct rswitch_desc.
> So, I'll modify this function like below:
> ---
> /* All struct rswitch_xxx_desc just extend struct rswitch_desc, so that
>  * we can use rswitch_desc_get_dptr() for them.
>  */
> static dma_addr_t rswitch_desc_get_dptr(void *_desc)
> {
>         struct rswitch_desc *desc = _desc;
>
>         return __le32_to_cpu(desc->dptrl) | (u64)(desc->dptrh) << 32;
> }

While the above would work, the void * parameter inhibits compiler checks.

Hence I suggest defining struct rswitch_ext_desc like:

    struct rswitch_ext_desc {
            struct rswitch_desc desc;
            __le64 info1;
    };

Then you can just pass &ext->desc to a function that takes a
(const) struct rswitch_desc *.


Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ