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: <cf22654ba1e726c3f3d1acf7eff2bc167de810c7.camel@mellanox.com>
Date:   Thu, 4 Jun 2020 04:44:00 +0000
From:   Saeed Mahameed <saeedm@...lanox.com>
To:     "natechancellor@...il.com" <natechancellor@...il.com>,
        "leon@...nel.org" <leon@...nel.org>
CC:     "linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
        "clang-built-linux@...glegroups.com" 
        <clang-built-linux@...glegroups.com>,
        Vu Pham <vuhuong@...lanox.com>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "kuba@...nel.org" <kuba@...nel.org>,
        Leon Romanovsky <leonro@...lanox.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH net] net/mlx5: Don't fail driver on failure to create
 debugfs

On Wed, 2020-06-03 at 11:34 -0700, Nathan Chancellor wrote:
> On Tue, Jun 02, 2020 at 12:27:24PM -0700, Nathan Chancellor wrote:
> > On Tue, Jun 02, 2020 at 03:28:37PM +0300, Leon Romanovsky wrote:
> > > From: Leon Romanovsky <leonro@...lanox.com>
> > > 
> > > Clang warns:
> > > 
> > > drivers/net/ethernet/mellanox/mlx5/core/main.c:1278:6: warning:
> > > variable
> > > 'err' is used uninitialized whenever 'if' condition is true
> > > [-Wsometimes-uninitialized]
> > >         if (!priv->dbg_root) {
> > >             ^~~~~~~~~~~~~~~
> > > drivers/net/ethernet/mellanox/mlx5/core/main.c:1303:9: note:
> > > uninitialized use occurs here
> > >         return err;
> > >                ^~~
> > > drivers/net/ethernet/mellanox/mlx5/core/main.c:1278:2: note:
> > > remove the
> > > 'if' if its condition is always false
> > >         if (!priv->dbg_root) {
> > >         ^~~~~~~~~~~~~~~~~~~~~~
> > > drivers/net/ethernet/mellanox/mlx5/core/main.c:1259:9: note:
> > > initialize
> > > the variable 'err' to silence this warning
> > >         int err;
> > >                ^
> > >                 = 0
> > > 1 warning generated.
> > > 
> > > The check of returned value of debugfs_create_dir() is wrong
> > > because
> > > by the design debugfs failures should never fail the driver and
> > > the
> > > check itself was wrong too. The kernel compiled without
> > > CONFIG_DEBUG_FS
> > > will return ERR_PTR(-ENODEV) and not NULL as expected.
> > > 
> > > Fixes: 11f3b84d7068 ("net/mlx5: Split mdev init and pci init")
> > > Link: https://github.com/ClangBuiltLinux/linux/issues/1042
> > > Reported-by: Nathan Chancellor <natechancellor@...il.com>
> > > Signed-off-by: Leon Romanovsky <leonro@...lanox.com>
> > 
> > Thanks! That's what I figured it should be.
> > 
> > Reviewed-by: Nathan Chancellor <natechancellor@...il.com>
> > 
> > > ---
> > > Original discussion:
> > > https://lore.kernel.org/lkml/20200530055447.1028004-1-natechancellor@gmail.com
> > > ---
> > >  drivers/net/ethernet/mellanox/mlx5/core/main.c | 5 -----
> > >  1 file changed, 5 deletions(-)
> > > 
> > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c
> > > b/drivers/net/ethernet/mellanox/mlx5/core/main.c
> > > index df46b1fce3a7..110e8d277d15 100644
> > > --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
> > > +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
> > > @@ -1275,11 +1275,6 @@ static int mlx5_mdev_init(struct
> > > mlx5_core_dev *dev, int profile_idx)
> > > 
> > >  	priv->dbg_root = debugfs_create_dir(dev_name(dev->device),
> > >  					    mlx5_debugfs_root);
> > > -	if (!priv->dbg_root) {
> > > -		dev_err(dev->device, "mlx5_core: error, Cannot create
> > > debugfs dir, aborting\n");
> > > -		goto err_dbg_root;
> 
> Actually, this removes the only use of err_dbg_root, so that should
> be
> removed at the same time.
> 

Fixed this up and applied to net-next-mlx5, 
Thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ