linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] IB/iser: remove uninitialized variable len
@ 2019-03-16 23:05 Colin King
  2019-03-17 10:05 ` Max Gurtovoy
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Colin King @ 2019-03-16 23:05 UTC (permalink / raw)
  To: Sagi Grimberg, Max Gurtovoy, Doug Ledford, Jason Gunthorpe, linux-rdma
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The variable len is not being inintialized and the uninitialized
value is being returned. However, this return path is never reached
because the default case in the switch statement returns -ENOSYS.
Clean up the code by replacing the return -ENOSYS with a break
for the default case and returning -ENOSYS at the end of the
function.  This allows len to be removed.  Also remove redundant
break that follows a return statement.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/infiniband/ulp/iser/iscsi_iser.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c
index 8c707accd148..9c185a8dabd3 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -763,7 +763,6 @@ static int iscsi_iser_get_ep_param(struct iscsi_endpoint *ep,
 				   enum iscsi_param param, char *buf)
 {
 	struct iser_conn *iser_conn = ep->dd_data;
-	int len;
 
 	switch (param) {
 	case ISCSI_PARAM_CONN_PORT:
@@ -774,12 +773,10 @@ static int iscsi_iser_get_ep_param(struct iscsi_endpoint *ep,
 		return iscsi_conn_get_addr_param((struct sockaddr_storage *)
 				&iser_conn->ib_conn.cma_id->route.addr.dst_addr,
 				param, buf);
-		break;
 	default:
-		return -ENOSYS;
+		break;
 	}
-
-	return len;
+	return -ENOSYS;
 }
 
 /**
-- 
2.20.1


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

* Re: [PATCH] IB/iser: remove uninitialized variable len
  2019-03-16 23:05 [PATCH] IB/iser: remove uninitialized variable len Colin King
@ 2019-03-17 10:05 ` Max Gurtovoy
  2019-03-18 21:44 ` Sagi Grimberg
  2019-03-27 13:21 ` Jason Gunthorpe
  2 siblings, 0 replies; 4+ messages in thread
From: Max Gurtovoy @ 2019-03-17 10:05 UTC (permalink / raw)
  To: Colin King, Sagi Grimberg, Doug Ledford, Jason Gunthorpe, linux-rdma
  Cc: kernel-janitors, linux-kernel


On 3/17/2019 1:05 AM, Colin King wrote:
> From: Colin Ian King<colin.king@canonical.com>
>
> The variable len is not being inintialized and the uninitialized
> value is being returned. However, this return path is never reached
> because the default case in the switch statement returns -ENOSYS.
> Clean up the code by replacing the return -ENOSYS with a break
> for the default case and returning -ENOSYS at the end of the
> function.  This allows len to be removed.  Also remove redundant
> break that follows a return statement.
>
> Signed-off-by: Colin Ian King<colin.king@canonical.com>

Looks good,

Reviewed-by: Max Gurtovoy <maxg@mellanox.com>


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

* Re: [PATCH] IB/iser: remove uninitialized variable len
  2019-03-16 23:05 [PATCH] IB/iser: remove uninitialized variable len Colin King
  2019-03-17 10:05 ` Max Gurtovoy
@ 2019-03-18 21:44 ` Sagi Grimberg
  2019-03-27 13:21 ` Jason Gunthorpe
  2 siblings, 0 replies; 4+ messages in thread
From: Sagi Grimberg @ 2019-03-18 21:44 UTC (permalink / raw)
  To: Colin King, Max Gurtovoy, Doug Ledford, Jason Gunthorpe, linux-rdma
  Cc: kernel-janitors, linux-kernel

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>

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

* Re: [PATCH] IB/iser: remove uninitialized variable len
  2019-03-16 23:05 [PATCH] IB/iser: remove uninitialized variable len Colin King
  2019-03-17 10:05 ` Max Gurtovoy
  2019-03-18 21:44 ` Sagi Grimberg
@ 2019-03-27 13:21 ` Jason Gunthorpe
  2 siblings, 0 replies; 4+ messages in thread
From: Jason Gunthorpe @ 2019-03-27 13:21 UTC (permalink / raw)
  To: Colin King
  Cc: Sagi Grimberg, Max Gurtovoy, Doug Ledford, linux-rdma,
	kernel-janitors, linux-kernel

On Sat, Mar 16, 2019 at 11:05:12PM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The variable len is not being inintialized and the uninitialized
> value is being returned. However, this return path is never reached
> because the default case in the switch statement returns -ENOSYS.
> Clean up the code by replacing the return -ENOSYS with a break
> for the default case and returning -ENOSYS at the end of the
> function.  This allows len to be removed.  Also remove redundant
> break that follows a return statement.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> Reviewed-by: Max Gurtovoy <maxg@mellanox.com>
> Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
> ---
>  drivers/infiniband/ulp/iser/iscsi_iser.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)

Applied to for-next

Thanks,
Jason

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

end of thread, other threads:[~2019-03-27 13:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-16 23:05 [PATCH] IB/iser: remove uninitialized variable len Colin King
2019-03-17 10:05 ` Max Gurtovoy
2019-03-18 21:44 ` Sagi Grimberg
2019-03-27 13:21 ` Jason Gunthorpe

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).