lkml.org 
[lkml]   [2018]   [Oct]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH net-next v2 1/2] net: phy: mscc: fix signedness bug in vsc85xx_downshift_get
From
Date
Hi,

On 10/10/18 10:30 AM, Gustavo A. R. Silva wrote:
> Currently, the error handling for the call to function
> phy_read_paged() doesn't work because *reg_val* is of
> type u16 (16 bits, unsigned), which makes it impossible
> for it to hold a value less than 0.
>
> Fix this by changing the type of variable *reg_val* to int.
>
> Addresses-Coverity-ID: 1473970 ("Unsigned compared against 0")
> Fixes: 6a0bfbbe20b0 ("net: phy: mscc: migrate to phy_select/restore_page functions")
> Reviewed-by: Quentin Schulz <quentin.schulz@bootlin.com>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
> Changes in v2:
> - Add Quentin's Reviewed-by to the commit log.
>
> drivers/net/phy/mscc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/phy/mscc.c b/drivers/net/phy/mscc.c
> index bffe077..bff56c3 100644
> --- a/drivers/net/phy/mscc.c
> +++ b/drivers/net/phy/mscc.c
> @@ -522,7 +522,7 @@ static int vsc85xx_mdix_set(struct phy_device *phydev, u8 mdix)
>
> static int vsc85xx_downshift_get(struct phy_device *phydev, u8 *count)
> {
> - u16 reg_val;
> + int reg_val;
>
> reg_val = phy_read_paged(phydev, MSCC_PHY_PAGE_EXTENDED,
> MSCC_PHY_ACTIPHY_CNTL);
>

Friendly ping. Dave, can you take this?

Thanks!
--
Gustavo

\
 
 \ /
  Last update: 2018-10-16 11:13    [W:0.051 / U:3.540 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site