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: <ae79823f-3697-feee-32e6-645c6f4b4e93@omp.ru>
Date:   Mon, 9 May 2022 10:49:49 +0300
From:   Sergey Shtylyov <s.shtylyov@....ru>
To:     Andrew Lunn <andrew@...n.ch>, netdev <netdev@...r.kernel.org>
CC:     Sean Wang <sean.wang@...iatek.com>,
        Landen Chao <Landen.Chao@...iatek.com>,
        DENG Qingfang <dqfext@...il.com>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        "Vladimir Oltean" <olteanv@...il.com>,
        Matthias Brugger <matthias.bgg@...il.com>,
        "Joakim Zhang" <qiangqing.zhang@....com>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Russell King <linux@...linux.org.uk>,
        Tobias Waldekranz <tobias@...dekranz.com>,
        Marcin Wojtas <mw@...ihalf.com>,
        Calvin Johnson <calvin.johnson@....nxp.com>,
        Markus Koch <markus@...syncing.net>,
        "Geert Uytterhoeven" <geert+renesas@...der.be>,
        Yang Yingliang <yangyingliang@...wei.com>,
        Hao Chen <chenhao288@...ilicon.com>
Subject: Re: [PATCH net-next 02/10] net: mdio: mdiobus_register: Update
 validation test

Hello!

On 5/8/22 6:30 PM, Andrew Lunn wrote:

> Now that C45 uses its own read/write methods, the validation performed
> when a bus is registers needs updating. All combinations of C22 and
> C45 are supported, but both read and write methods must be provided,
> read only busses are not supported etc.
> 
> Signed-off-by: Andrew Lunn <andrew@...n.ch>
> ---
>  drivers/net/phy/mdio_bus.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
> index 46a03c0b45e3..818d22fb3cb5 100644
> --- a/drivers/net/phy/mdio_bus.c
> +++ b/drivers/net/phy/mdio_bus.c
> @@ -526,8 +526,16 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner)
>  	int i, err;
>  	struct gpio_desc *gpiod;
>  
> -	if (NULL == bus || NULL == bus->name ||
> -	    NULL == bus->read || NULL == bus->write)
> +	if (NULL == bus || NULL == bus->name)

   I suggest (!bus || !bus->name) to be consistent with the code below.
   BTW, doesn't checkpatch.pl complain about NULL == bus?

> +		return -EINVAL;
> +
> +	if (!bus->read != !bus->write)
> +		return -EINVAL;
> +
> +	if (!bus->read_c45 != !bus->write_c45)
> +		return -EINVAL;

   Hm, that's complicated! :-)

> +
> +	if (!bus->read && !bus->read_c45)
>  		return -EINVAL;
>  
>  	if (bus->parent && bus->parent->of_node)

MBR, Sergey

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ