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: <907aca10-130b-3f2f-3960-eca019af3664@mellanox.com>
Date:   Sun, 25 Feb 2018 12:04:55 +0200
From:   Arkadi Sharshevsky <arkadis@...lanox.com>
To:     Arnd Bergmann <arnd@...db.de>, Jiri Pirko <jiri@...lanox.com>,
        Ido Schimmel <idosch@...lanox.com>
Cc:     "David S. Miller" <davem@...emloft.net>,
        Wei Yongjun <weiyongjun1@...wei.com>, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [net-next PATCH 2/2] mlxsw: spectrum_kvdl: avoid uninitialized
 variable warning



On 02/23/2018 03:15 PM, Arnd Bergmann wrote:
> gcc warns that 'resource_id' is not initialized if we don't come though
> any of the three 'case' statements before:
> 
> drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c: In function 'mlxsw_sp_kvdl_part_init':
> drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c:275:8: error: 'resource_id' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> 
> In the current code, that won't happen, but it's more robust to explicitly
> handle this by returning a failure from mlxsw_sp_kvdl_part_init.
> 
> Fixes: 887839e6960d ("mlxsw: spectrum_kvdl: Add support for dynamic partition set")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
>  drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c
> index 6fd701db90c9..059eb3214328 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c
> @@ -270,6 +270,8 @@ static int mlxsw_sp_kvdl_part_init(struct mlxsw_sp *mlxsw_sp,
>  	case MLXSW_SP_KVDL_PART_LARGE_CHUNKS:
>  		resource_id = MLXSW_SP_RESOURCE_KVD_LINEAR_LARGE_CHUNKS;
>  		break;
> +	default:
> +		return -EINVAL;
>  	}
>  
>  	err = devlink_resource_size_get(devlink, resource_id, &resource_size);
> 
Acked-by: Arkadi Sharshevsky <arkadis@...lanox.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ