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]
Date:	Sun, 04 Jan 2015 22:03:49 +0000
From:	Ben Hutchings <ben@...adent.org.uk>
To:	David Decotigny <ddecotig@...il.com>
Cc:	Amir Vadai <amirv@...lanox.com>,
	Florian Fainelli <f.fainelli@...il.com>,
	netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-api@...r.kernel.org, David Decotigny <decot@...glers.com>,
	"David S. Miller" <davem@...emloft.net>,
	Jason Wang <jasowang@...hat.com>,
	"Michael S. Tsirkin" <mst@...hat.com>,
	Herbert Xu <herbert@...dor.apana.org.au>,
	Al Viro <viro@...iv.linux.org.uk>,
	Masatake YAMATO <yamato@...hat.com>, Xi Wang <xii@...gle.com>,
	Neil Horman <nhorman@...driver.com>,
	WANG Cong <xiyou.wangcong@...il.com>,
	Flavio Leitner <fbl@...hat.com>, Tom Gundersen <teg@...m.no>,
	Jiri Pirko <jiri@...nulli.us>,
	Vlad Yasevich <vyasevic@...hat.com>,
	"Eric W. Biederman" <ebiederm@...ssion.com>,
	Saeed Mahameed <saeedm@...lanox.com>,
	Venkata Duvvuru <VenkatKumar.Duvvuru@...lex.Com>,
	Govindarajulu Varadarajan <_govind@....com>
Subject: Re: [PATCH net-next v1 2/7] net: phy: extend link mode support to
 48 bits

On Sun, 2015-01-04 at 12:56 -0800, David Decotigny wrote:
> From: David Decotigny <decot@...glers.com>
> 
> Signed-off-by: David Decotigny <decot@...glers.com>
> ---
>  drivers/net/phy/phy.c        | 29 ++++++++++++++---------------
>  drivers/net/phy/phy_device.c |  4 ++--
>  include/linux/phy.h          | 10 +++++-----
>  3 files changed, 21 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index 767cd11..e9c8499 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
[...]
> @@ -245,7 +246,7 @@ static inline unsigned int phy_find_valid(unsigned int idx, u32 features)
>   */
>  static void phy_sanitize_settings(struct phy_device *phydev)
>  {
> -	u32 features = phydev->supported;
> +	ethtool_link_mode_mask_t features = phydev->supported;
>  	unsigned int idx;
>  
>  	/* Sanitize settings based on PHY capabilities */
> @@ -279,13 +280,13 @@ int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd)
>  		return -EINVAL;
>  
>  	/* We make sure that we don't pass unsupported values in to the PHY */
> -	cmd->advertising &= phydev->supported;
> +	phydev->advertising = ethtool_cmd_advertising(cmd) & phydev->supported;

phydev->advertising should not be changed until after the following
validation.  Use a local variable for this.

>  	/* Verify the settings we care about. */
>  	if (cmd->autoneg != AUTONEG_ENABLE && cmd->autoneg != AUTONEG_DISABLE)
>  		return -EINVAL;
>  
> -	if (cmd->autoneg == AUTONEG_ENABLE && cmd->advertising == 0)
> +	if (cmd->autoneg == AUTONEG_ENABLE && phydev->advertising == 0)
>  		return -EINVAL;
>  
>  	if (cmd->autoneg == AUTONEG_DISABLE &&
> @@ -300,8 +301,6 @@ int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd)
>  
>  	phydev->speed = speed;
>  
> -	phydev->advertising = cmd->advertising;
> -
>  	if (AUTONEG_ENABLE == cmd->autoneg)
>  		phydev->advertising |= ADVERTISED_Autoneg;
>  	else
[...]

The assignment to phydev->advertising should probably remain here.

Ben.

-- 
Ben Hutchings
This sentence contradicts itself - no actually it doesn't.

Download attachment "signature.asc" of type "application/pgp-signature" (812 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ