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: <CA+h21hpuYeyT6vPTXHQ-oJDcFuOb_q3L+t660YayPeDXm0AGtw@mail.gmail.com>
Date:   Sat, 1 Jun 2019 23:30:16 +0300
From:   Vladimir Oltean <olteanv@...il.com>
To:     Andrew Lunn <andrew@...n.ch>
Cc:     Florian Fainelli <f.fainelli@...il.com>,
        Vivien Didelot <vivien.didelot@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH net 1/2] net: dsa: sja1105: Force a negative value for
 enum sja1105_speed_t

On Sat, 1 Jun 2019 at 19:03, Andrew Lunn <andrew@...n.ch> wrote:
>
> On Sat, Jun 01, 2019 at 01:37:34PM +0300, Vladimir Oltean wrote:
> > The code in sja1105_adjust_port_config relies on the fact that an
> > invalid link speed is detected by sja1105_get_speed_cfg and returned as
> > -EINVAL.  However storing this into an enum that only has positive
> > members will cast it into an unsigned value, and it will miss the
> > negative check.
> >
> > So make the -EINVAL value part of the enum, so that it is stored as a
> > signed number and passes the negative check.
> >
> > Fixes: 8aa9ebccae87 ("net: dsa: Introduce driver for NXP SJA1105 5-port L2 switch")
> > Signed-off-by: Vladimir Oltean <olteanv@...il.com>
>
> Hi Vladimir
>
> It seems like just using a switch statement would be simpler, and more
> likely to be correct. And it would avoid adding SJA1105_SPEED_INVALID
> = -EINVAL which feels hackish.
>
>   Andrew

Hi Andrew,

You mean I should completely remove the sja1105_get_speed_cfg function?
I suppose I can do that, I'm only using it in one place.

Thanks,
-Vladimir

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ