linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH rdma-next 0/2] Fix warnings reported by kbuild
@ 2020-07-19  6:03 Leon Romanovsky
  2020-07-19  6:03 ` [PATCH rdma-next 1/2] RDMA/uverbs: Remove redundant assignments Leon Romanovsky
  2020-07-19  6:03 ` [PATCH rdma-next 2/2] RDMA/uverbs: Silence shiftTooManyBitsSigned warning Leon Romanovsky
  0 siblings, 2 replies; 8+ messages in thread
From: Leon Romanovsky @ 2020-07-19  6:03 UTC (permalink / raw)
  To: Doug Ledford, Jason Gunthorpe
  Cc: Leon Romanovsky, kernel test robot, linux-kernel, linux-rdma

From: Leon Romanovsky <leonro@mellanox.com>

Hi,

There are two change as were reported by kbuild. They are not important
enough to have Fixes line.

Thanks

Leon Romanovsky (2):
  RDMA/uverbs: Remove redundant assignments
  RDMA/uverbs: Silence shiftTooManyBitsSigned warning

 drivers/infiniband/core/uverbs_cmd.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

--
2.26.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH rdma-next 1/2] RDMA/uverbs: Remove redundant assignments
  2020-07-19  6:03 [PATCH rdma-next 0/2] Fix warnings reported by kbuild Leon Romanovsky
@ 2020-07-19  6:03 ` Leon Romanovsky
  2020-07-19 12:51   ` leon
  2020-07-19 13:21   ` Gal Pressman
  2020-07-19  6:03 ` [PATCH rdma-next 2/2] RDMA/uverbs: Silence shiftTooManyBitsSigned warning Leon Romanovsky
  1 sibling, 2 replies; 8+ messages in thread
From: Leon Romanovsky @ 2020-07-19  6:03 UTC (permalink / raw)
  To: Doug Ledford, Jason Gunthorpe
  Cc: Leon Romanovsky, kernel test robot, linux-rdma

From: Leon Romanovsky <leonro@mellanox.com>

The kbuild reported the following warning, so clean whole uverbs_cmd.c file.

   drivers/infiniband/core/uverbs_cmd.c:1066:6: warning: Variable 'ret'
is reassigned a value before the old one has
been used. [redundantAssignment]
    ret = uverbs_request(attrs, &cmd, sizeof(cmd));
        ^
   drivers/infiniband/core/uverbs_cmd.c:1064:0: note: Variable 'ret' is
reassigned a value before the old one has been
used.
    int    ret = -EINVAL;
   ^

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/core/uverbs_cmd.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index a66fc3e37a74..7d2b4258f573 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -558,9 +558,9 @@ static int ib_uverbs_open_xrcd(struct uverbs_attr_bundle *attrs)
 	struct ib_uverbs_open_xrcd	cmd;
 	struct ib_uxrcd_object         *obj;
 	struct ib_xrcd                 *xrcd = NULL;
-	struct fd			f = {NULL, 0};
+	struct fd f = {};
 	struct inode                   *inode = NULL;
-	int				ret = 0;
+	int ret;
 	int				new_xrcd = 0;
 	struct ib_device *ib_dev;
 
@@ -761,7 +761,7 @@ static int ib_uverbs_rereg_mr(struct uverbs_attr_bundle *attrs)
 {
 	struct ib_uverbs_rereg_mr      cmd;
 	struct ib_uverbs_rereg_mr_resp resp;
-	struct ib_pd                *pd = NULL;
+	struct ib_pd *pd;
 	struct ib_mr                *mr;
 	struct ib_pd		    *old_pd;
 	int                          ret;
@@ -1059,7 +1059,7 @@ static int ib_uverbs_resize_cq(struct uverbs_attr_bundle *attrs)
 	struct ib_uverbs_resize_cq	cmd;
 	struct ib_uverbs_resize_cq_resp	resp = {};
 	struct ib_cq			*cq;
-	int				ret = -EINVAL;
+	int ret;
 
 	ret = uverbs_request(attrs, &cmd, sizeof(cmd));
 	if (ret)
@@ -1504,7 +1504,7 @@ static int ib_uverbs_open_qp(struct uverbs_attr_bundle *attrs)
 	struct ib_uverbs_open_qp        cmd;
 	struct ib_uqp_object           *obj;
 	struct ib_xrcd		       *xrcd;
-	struct ib_uobject	       *uninitialized_var(xrcd_uobj);
+	struct ib_uobject *xrcd_uobj;
 	struct ib_qp                   *qp;
 	struct ib_qp_open_attr          attr = {};
 	int ret;
@@ -3286,7 +3286,7 @@ static int __uverbs_create_xsrq(struct uverbs_attr_bundle *attrs,
 	struct ib_usrq_object           *obj;
 	struct ib_pd                    *pd;
 	struct ib_srq                   *srq;
-	struct ib_uobject               *uninitialized_var(xrcd_uobj);
+	struct ib_uobject *xrcd_uobj;
 	struct ib_srq_init_attr          attr;
 	int ret;
 	struct ib_device *ib_dev;
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH rdma-next 2/2] RDMA/uverbs: Silence shiftTooManyBitsSigned warning
  2020-07-19  6:03 [PATCH rdma-next 0/2] Fix warnings reported by kbuild Leon Romanovsky
  2020-07-19  6:03 ` [PATCH rdma-next 1/2] RDMA/uverbs: Remove redundant assignments Leon Romanovsky
@ 2020-07-19  6:03 ` Leon Romanovsky
  1 sibling, 0 replies; 8+ messages in thread
From: Leon Romanovsky @ 2020-07-19  6:03 UTC (permalink / raw)
  To: Doug Ledford, Jason Gunthorpe
  Cc: Leon Romanovsky, kernel test robot, linux-rdma

From: Leon Romanovsky <leonro@mellanox.com>

Fix reported by kbuild warning.

   drivers/infiniband/core/uverbs_cmd.c:1897:47: warning: Shifting
signed 32-bit value by 31 bits is undefined
behaviour [shiftTooManyBitsSigned]
    BUILD_BUG_ON(IB_USER_LAST_QP_ATTR_MASK == (1 << 31));
                                                 ^
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/core/uverbs_cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index 7d2b4258f573..51f8e5464f10 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -1892,7 +1892,7 @@ static int ib_uverbs_ex_modify_qp(struct uverbs_attr_bundle *attrs)
 	 * Last bit is reserved for extending the attr_mask by
 	 * using another field.
 	 */
-	BUILD_BUG_ON(IB_USER_LAST_QP_ATTR_MASK == (1 << 31));
+	BUILD_BUG_ON(IB_USER_LAST_QP_ATTR_MASK == (1ULL << 31));
 
 	if (cmd.base.attr_mask &
 	    ~((IB_USER_LAST_QP_ATTR_MASK << 1) - 1))
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH rdma-next 1/2] RDMA/uverbs: Remove redundant assignments
  2020-07-19  6:03 ` [PATCH rdma-next 1/2] RDMA/uverbs: Remove redundant assignments Leon Romanovsky
@ 2020-07-19 12:51   ` leon
  2020-07-19 13:21   ` Gal Pressman
  1 sibling, 0 replies; 8+ messages in thread
From: leon @ 2020-07-19 12:51 UTC (permalink / raw)
  To: Doug Ledford, Jason Gunthorpe; +Cc: kernel test robot, linux-rdma

On Sun, Jul 19, 2020 at 09:03:18AM +0300, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@mellanox.com>
>
> The kbuild reported the following warning, so clean whole uverbs_cmd.c file.
>
>    drivers/infiniband/core/uverbs_cmd.c:1066:6: warning: Variable 'ret'
> is reassigned a value before the old one has
> been used. [redundantAssignment]
>     ret = uverbs_request(attrs, &cmd, sizeof(cmd));
>         ^
>    drivers/infiniband/core/uverbs_cmd.c:1064:0: note: Variable 'ret' is
> reassigned a value before the old one has been
> used.
>     int    ret = -EINVAL;
>    ^
>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> ---
>  drivers/infiniband/core/uverbs_cmd.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
> index a66fc3e37a74..7d2b4258f573 100644
> --- a/drivers/infiniband/core/uverbs_cmd.c
> +++ b/drivers/infiniband/core/uverbs_cmd.c
> @@ -558,9 +558,9 @@ static int ib_uverbs_open_xrcd(struct uverbs_attr_bundle *attrs)
>  	struct ib_uverbs_open_xrcd	cmd;
>  	struct ib_uxrcd_object         *obj;
>  	struct ib_xrcd                 *xrcd = NULL;
> -	struct fd			f = {NULL, 0};
> +	struct fd f = {};
>  	struct inode                   *inode = NULL;
> -	int				ret = 0;
> +	int ret;
>  	int				new_xrcd = 0;
>  	struct ib_device *ib_dev;
>
> @@ -761,7 +761,7 @@ static int ib_uverbs_rereg_mr(struct uverbs_attr_bundle *attrs)
>  {
>  	struct ib_uverbs_rereg_mr      cmd;
>  	struct ib_uverbs_rereg_mr_resp resp;
> -	struct ib_pd                *pd = NULL;
> +	struct ib_pd *pd;

This line shouldn't be changed, PD is passed as an argument to ops.rereg_user_mr.

Thanks

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH rdma-next 1/2] RDMA/uverbs: Remove redundant assignments
  2020-07-19  6:03 ` [PATCH rdma-next 1/2] RDMA/uverbs: Remove redundant assignments Leon Romanovsky
  2020-07-19 12:51   ` leon
@ 2020-07-19 13:21   ` Gal Pressman
  2020-07-19 13:27     ` Leon Romanovsky
  1 sibling, 1 reply; 8+ messages in thread
From: Gal Pressman @ 2020-07-19 13:21 UTC (permalink / raw)
  To: Leon Romanovsky, Doug Ledford, Jason Gunthorpe
  Cc: Leon Romanovsky, kernel test robot, linux-rdma

On 19/07/2020 9:03, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@mellanox.com>
> 
> The kbuild reported the following warning, so clean whole uverbs_cmd.c file.
> 
>    drivers/infiniband/core/uverbs_cmd.c:1066:6: warning: Variable 'ret'
> is reassigned a value before the old one has
> been used. [redundantAssignment]
>     ret = uverbs_request(attrs, &cmd, sizeof(cmd));
>         ^
>    drivers/infiniband/core/uverbs_cmd.c:1064:0: note: Variable 'ret' is
> reassigned a value before the old one has been
> used.
>     int    ret = -EINVAL;
>    ^
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> ---
>  drivers/infiniband/core/uverbs_cmd.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
> index a66fc3e37a74..7d2b4258f573 100644
> --- a/drivers/infiniband/core/uverbs_cmd.c
> +++ b/drivers/infiniband/core/uverbs_cmd.c
> @@ -558,9 +558,9 @@ static int ib_uverbs_open_xrcd(struct uverbs_attr_bundle *attrs)
>  	struct ib_uverbs_open_xrcd	cmd;
>  	struct ib_uxrcd_object         *obj;
>  	struct ib_xrcd                 *xrcd = NULL;
> -	struct fd			f = {NULL, 0};
> +	struct fd f = {};
>  	struct inode                   *inode = NULL;
> -	int				ret = 0;
> +	int ret;
>  	int				new_xrcd = 0;
>  	struct ib_device *ib_dev;

I don't mind removing the whitespace, but changing it for just some of the
variables makes it harder to read the code IMO.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH rdma-next 1/2] RDMA/uverbs: Remove redundant assignments
  2020-07-19 13:21   ` Gal Pressman
@ 2020-07-19 13:27     ` Leon Romanovsky
  2020-07-20 14:27       ` Jason Gunthorpe
  0 siblings, 1 reply; 8+ messages in thread
From: Leon Romanovsky @ 2020-07-19 13:27 UTC (permalink / raw)
  To: Gal Pressman; +Cc: Doug Ledford, Jason Gunthorpe, kernel test robot, linux-rdma

On Sun, Jul 19, 2020 at 04:21:04PM +0300, Gal Pressman wrote:
> On 19/07/2020 9:03, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@mellanox.com>
> >
> > The kbuild reported the following warning, so clean whole uverbs_cmd.c file.
> >
> >    drivers/infiniband/core/uverbs_cmd.c:1066:6: warning: Variable 'ret'
> > is reassigned a value before the old one has
> > been used. [redundantAssignment]
> >     ret = uverbs_request(attrs, &cmd, sizeof(cmd));
> >         ^
> >    drivers/infiniband/core/uverbs_cmd.c:1064:0: note: Variable 'ret' is
> > reassigned a value before the old one has been
> > used.
> >     int    ret = -EINVAL;
> >    ^
> >
> > Reported-by: kernel test robot <lkp@intel.com>
> > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> > ---
> >  drivers/infiniband/core/uverbs_cmd.c | 12 ++++++------
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
> > index a66fc3e37a74..7d2b4258f573 100644
> > --- a/drivers/infiniband/core/uverbs_cmd.c
> > +++ b/drivers/infiniband/core/uverbs_cmd.c
> > @@ -558,9 +558,9 @@ static int ib_uverbs_open_xrcd(struct uverbs_attr_bundle *attrs)
> >  	struct ib_uverbs_open_xrcd	cmd;
> >  	struct ib_uxrcd_object         *obj;
> >  	struct ib_xrcd                 *xrcd = NULL;
> > -	struct fd			f = {NULL, 0};
> > +	struct fd f = {};
> >  	struct inode                   *inode = NULL;
> > -	int				ret = 0;
> > +	int ret;
> >  	int				new_xrcd = 0;
> >  	struct ib_device *ib_dev;
>
> I don't mind removing the whitespace, but changing it for just some of the
> variables makes it harder to read the code IMO.

I wanted to remove for all variables in the same patch but was afraid to hear
opposition and waste my time on redoing it.

Once we decide that this should be done, we will change. It will take less than
ten seconds with clang-formatter.

Thanks

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH rdma-next 1/2] RDMA/uverbs: Remove redundant assignments
  2020-07-19 13:27     ` Leon Romanovsky
@ 2020-07-20 14:27       ` Jason Gunthorpe
  2020-07-20 16:57         ` Leon Romanovsky
  0 siblings, 1 reply; 8+ messages in thread
From: Jason Gunthorpe @ 2020-07-20 14:27 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: Gal Pressman, Doug Ledford, kernel test robot, linux-rdma

On Sun, Jul 19, 2020 at 04:27:33PM +0300, Leon Romanovsky wrote:
> On Sun, Jul 19, 2020 at 04:21:04PM +0300, Gal Pressman wrote:
> > On 19/07/2020 9:03, Leon Romanovsky wrote:
> > > From: Leon Romanovsky <leonro@mellanox.com>
> > >
> > > The kbuild reported the following warning, so clean whole uverbs_cmd.c file.
> > >
> > >    drivers/infiniband/core/uverbs_cmd.c:1066:6: warning: Variable 'ret'
> > > is reassigned a value before the old one has
> > > been used. [redundantAssignment]
> > >     ret = uverbs_request(attrs, &cmd, sizeof(cmd));
> > >         ^
> > >    drivers/infiniband/core/uverbs_cmd.c:1064:0: note: Variable 'ret' is
> > > reassigned a value before the old one has been
> > > used.
> > >     int    ret = -EINVAL;
> > >    ^
> > >
> > > Reported-by: kernel test robot <lkp@intel.com>
> > > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> > >  drivers/infiniband/core/uverbs_cmd.c | 12 ++++++------
> > >  1 file changed, 6 insertions(+), 6 deletions(-)
> > >
> > > diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
> > > index a66fc3e37a74..7d2b4258f573 100644
> > > +++ b/drivers/infiniband/core/uverbs_cmd.c
> > > @@ -558,9 +558,9 @@ static int ib_uverbs_open_xrcd(struct uverbs_attr_bundle *attrs)
> > >  	struct ib_uverbs_open_xrcd	cmd;
> > >  	struct ib_uxrcd_object         *obj;
> > >  	struct ib_xrcd                 *xrcd = NULL;
> > > -	struct fd			f = {NULL, 0};
> > > +	struct fd f = {};
> > >  	struct inode                   *inode = NULL;
> > > -	int				ret = 0;
> > > +	int ret;
> > >  	int				new_xrcd = 0;
> > >  	struct ib_device *ib_dev;
> >
> > I don't mind removing the whitespace, but changing it for just some of the
> > variables makes it harder to read the code IMO.
> 
> I wanted to remove for all variables in the same patch but was afraid to hear
> opposition and waste my time on redoing it.
> 
> Once we decide that this should be done, we will change. It will take less than
> ten seconds with clang-formatter.

It has been something that is going on slowly, I'm not sure a big
reformatting is a good idea, it really messes up backporting

Maybe these changes could be moved to the end so it is more readable?

Jason

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH rdma-next 1/2] RDMA/uverbs: Remove redundant assignments
  2020-07-20 14:27       ` Jason Gunthorpe
@ 2020-07-20 16:57         ` Leon Romanovsky
  0 siblings, 0 replies; 8+ messages in thread
From: Leon Romanovsky @ 2020-07-20 16:57 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Gal Pressman, Doug Ledford, kernel test robot, linux-rdma

On Mon, Jul 20, 2020 at 11:27:55AM -0300, Jason Gunthorpe wrote:
> On Sun, Jul 19, 2020 at 04:27:33PM +0300, Leon Romanovsky wrote:
> > On Sun, Jul 19, 2020 at 04:21:04PM +0300, Gal Pressman wrote:
> > > On 19/07/2020 9:03, Leon Romanovsky wrote:
> > > > From: Leon Romanovsky <leonro@mellanox.com>
> > > >
> > > > The kbuild reported the following warning, so clean whole uverbs_cmd.c file.
> > > >
> > > >    drivers/infiniband/core/uverbs_cmd.c:1066:6: warning: Variable 'ret'
> > > > is reassigned a value before the old one has
> > > > been used. [redundantAssignment]
> > > >     ret = uverbs_request(attrs, &cmd, sizeof(cmd));
> > > >         ^
> > > >    drivers/infiniband/core/uverbs_cmd.c:1064:0: note: Variable 'ret' is
> > > > reassigned a value before the old one has been
> > > > used.
> > > >     int    ret = -EINVAL;
> > > >    ^
> > > >
> > > > Reported-by: kernel test robot <lkp@intel.com>
> > > > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> > > >  drivers/infiniband/core/uverbs_cmd.c | 12 ++++++------
> > > >  1 file changed, 6 insertions(+), 6 deletions(-)
> > > >
> > > > diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
> > > > index a66fc3e37a74..7d2b4258f573 100644
> > > > +++ b/drivers/infiniband/core/uverbs_cmd.c
> > > > @@ -558,9 +558,9 @@ static int ib_uverbs_open_xrcd(struct uverbs_attr_bundle *attrs)
> > > >  	struct ib_uverbs_open_xrcd	cmd;
> > > >  	struct ib_uxrcd_object         *obj;
> > > >  	struct ib_xrcd                 *xrcd = NULL;
> > > > -	struct fd			f = {NULL, 0};
> > > > +	struct fd f = {};
> > > >  	struct inode                   *inode = NULL;
> > > > -	int				ret = 0;
> > > > +	int ret;
> > > >  	int				new_xrcd = 0;
> > > >  	struct ib_device *ib_dev;
> > >
> > > I don't mind removing the whitespace, but changing it for just some of the
> > > variables makes it harder to read the code IMO.
> >
> > I wanted to remove for all variables in the same patch but was afraid to hear
> > opposition and waste my time on redoing it.
> >
> > Once we decide that this should be done, we will change. It will take less than
> > ten seconds with clang-formatter.
>
> It has been something that is going on slowly, I'm not sure a big
> reformatting is a good idea, it really messes up backporting
>
> Maybe these changes could be moved to the end so it is more readable?

Nice, I'll do it.

>
> Jason

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-07-20 16:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-19  6:03 [PATCH rdma-next 0/2] Fix warnings reported by kbuild Leon Romanovsky
2020-07-19  6:03 ` [PATCH rdma-next 1/2] RDMA/uverbs: Remove redundant assignments Leon Romanovsky
2020-07-19 12:51   ` leon
2020-07-19 13:21   ` Gal Pressman
2020-07-19 13:27     ` Leon Romanovsky
2020-07-20 14:27       ` Jason Gunthorpe
2020-07-20 16:57         ` Leon Romanovsky
2020-07-19  6:03 ` [PATCH rdma-next 2/2] RDMA/uverbs: Silence shiftTooManyBitsSigned warning Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).