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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
 <PAXPR83MB0557DE1F99908341801A11A6B4112@PAXPR83MB0557.EURPRD83.prod.outlook.com>
Date: Tue, 23 Apr 2024 07:15:41 +0000
From: Konstantin Taranov <kotaranov@...rosoft.com>
To: Nathan Chancellor <nathan@...nel.org>, Konstantin Taranov
	<kotaranov@...ux.microsoft.com>
CC: "sharmaajay@...rosoft.com" <sharmaajay@...rosoft.com>, Long Li
	<longli@...rosoft.com>, "jgg@...pe.ca" <jgg@...pe.ca>, "leon@...nel.org"
	<leon@...nel.org>, "linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH rdma-next v3 4/6] RDMA/mana_ib: enable RoCE on port 1

> Hi Konstantin,
> 
> On Wed, Apr 10, 2024 at 01:42:29AM -0700, Konstantin Taranov wrote:
> > From: Konstantin Taranov <kotaranov@...rosoft.com>
> >
> > Set netdev and RoCEv2 flag to enable GID population on port 1.
> > Use GIDs of the master netdev. As mc->ports[] stores slave devices,
> > use a helper to get the master netdev.
> >
> > Signed-off-by: Konstantin Taranov <kotaranov@...rosoft.com>
> > ---
> >  drivers/infiniband/hw/mana/device.c | 15 +++++++++++++++
> >  drivers/infiniband/hw/mana/main.c   | 15 +++++++++++----
> >  2 files changed, 26 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/infiniband/hw/mana/device.c
> > b/drivers/infiniband/hw/mana/device.c
> > index 47547a962b19..e7981301d10b 100644
> > --- a/drivers/infiniband/hw/mana/device.c
> > +++ b/drivers/infiniband/hw/mana/device.c
> > @@ -53,6 +53,7 @@ static int mana_ib_probe(struct auxiliary_device
> > *adev,  {
> >  	struct mana_adev *madev = container_of(adev, struct mana_adev,
> adev);
> >  	struct gdma_dev *mdev = madev->mdev;
> > +	struct net_device *upper_ndev;
> >  	struct mana_context *mc;
> >  	struct mana_ib_dev *dev;
> >  	int ret;
> > @@ -79,6 +80,20 @@ static int mana_ib_probe(struct auxiliary_device
> *adev,
> >  	dev->ib_dev.num_comp_vectors = 1;
> >  	dev->ib_dev.dev.parent = mdev->gdma_context->dev;
> >
> > +	rcu_read_lock(); /* required to get upper dev */
> > +	upper_ndev = netdev_master_upper_dev_get_rcu(mc->ports[0]);
> > +	if (!upper_ndev) {
> > +		rcu_read_unlock();
> > +		ibdev_err(&dev->ib_dev, "Failed to get master netdev");
> > +		goto free_ib_device;
> > +	}
> 
> Clang now warns (or errors with CONFIG_WERROR):
> 
>   drivers/infiniband/hw/mana/device.c:88:6: error: variable 'ret' is used
> uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-
> uninitialized]
>      88 |         if (!upper_ndev) {
>         |             ^~~~~~~~~~~
>   drivers/infiniband/hw/mana/device.c:150:9: note: uninitialized use occurs
> here
>     150 |         return ret;
>         |                ^~~
>   drivers/infiniband/hw/mana/device.c:88:2: note: remove the 'if' if its
> condition is always false
>      88 |         if (!upper_ndev) {
>         |         ^~~~~~~~~~~~~~~~~~
>      89 |                 rcu_read_unlock();
>         |                 ~~~~~~~~~~~~~~~~~~
>      90 |                 ibdev_err(&dev->ib_dev, "Failed to get master netdev");
>         |
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>      91 |                 goto free_ib_device;
>         |                 ~~~~~~~~~~~~~~~~~~~~
>      92 |         }
>         |         ~
>   drivers/infiniband/hw/mana/device.c:62:9: note: initialize the variable 'ret'
> to silence this warning
>      62 |         int ret;
>         |                ^
>         |                 = 0
>   1 error generated.
> 
> I could not really find a consistent return code for when
> netdev_master_upper_dev_get_rcu() fails. -ENODEV?

Thanks for catching this! Yes, I think ret = -ENODEV; is appropriate fix.
Should I send a patch to rdma-next? Or what should I do now to fix this?

Konstantin

> 
> Cheers,
> Nathan
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ