All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/4] Lustre Klocwork fixes
@ 2014-04-28  2:25 Oleg Drokin
  2014-04-28  2:25 ` [PATCH v3 1/4] staging/lustre/lnet: Drop useless LASSERT in ksocknal_select_ips Oleg Drokin
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Oleg Drokin @ 2014-04-28  2:25 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel, devel; +Cc: Oleg Drokin

This is just splitting big lnet fixes patch from Klocwork static
analysis tool into smaller bits.
Reworked according to previous comments.
Also, this time with correct CC list.

Dmitry Eremin (2):
  staging/lustre/lnet: remove unused variable in
    lnet_destroy_remote_nets_table
  staging/lustre/lnet: fix potential null pointer dereference in
    kiblnd_rejected

Oleg Drokin (2):
  staging/lustre/lnet: Drop useless LASSERT in ksocknal_select_ips
  staging/lustre/lnet: fix potential null pointer dereference

 drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 8 ++++++--
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c    | 4 ----
 drivers/staging/lustre/lnet/lnet/api-ni.c              | 6 +++---
 drivers/staging/lustre/lnet/lnet/router.c              | 2 +-
 4 files changed, 10 insertions(+), 10 deletions(-)

-- 
1.9.0


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

* [PATCH v3 1/4] staging/lustre/lnet: Drop useless LASSERT in ksocknal_select_ips
  2014-04-28  2:25 [PATCH v3 0/4] Lustre Klocwork fixes Oleg Drokin
@ 2014-04-28  2:25 ` Oleg Drokin
  2014-04-28  2:25 ` [PATCH v3 2/4] staging/lustre/lnet: remove unused variable in lnet_destroy_remote_nets_table Oleg Drokin
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Oleg Drokin @ 2014-04-28  2:25 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel, devel; +Cc: Oleg Drokin, Oleg Drokin

It should never be NULL because our interface list is up to date,
and even if it does, we'll just crash anyway so we are no better off.

Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index 21d36ee..a391d13 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -793,8 +793,6 @@ ksocknal_select_ips(ksock_peer_t *peer, __u32 *peerips, int n_peerips)
 			ip = peer->ksnp_passive_ips[i];
 			best_iface = ksocknal_ip2iface(peer->ksnp_ni, ip);
 
-			/* peer passive ips are kept up to date */
-			LASSERT(best_iface != NULL);
 		} else {
 			/* choose a new interface */
 			LASSERT (i == peer->ksnp_n_passive_ips);
@@ -835,8 +833,6 @@ ksocknal_select_ips(ksock_peer_t *peer, __u32 *peerips, int n_peerips)
 			peer->ksnp_n_passive_ips = i+1;
 		}
 
-		LASSERT (best_iface != NULL);
-
 		/* mark the best matching peer IP used */
 		j = ksocknal_match_peerip(best_iface, peerips, n_peerips);
 		peerips[j] = 0;
-- 
1.9.0


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

* [PATCH v3 2/4] staging/lustre/lnet: remove unused variable in lnet_destroy_remote_nets_table
  2014-04-28  2:25 [PATCH v3 0/4] Lustre Klocwork fixes Oleg Drokin
  2014-04-28  2:25 ` [PATCH v3 1/4] staging/lustre/lnet: Drop useless LASSERT in ksocknal_select_ips Oleg Drokin
@ 2014-04-28  2:25 ` Oleg Drokin
  2014-04-28  2:25 ` [PATCH v3 3/4] staging/lustre/lnet: fix potential null pointer dereference in kiblnd_rejected Oleg Drokin
  2014-04-28  2:25 ` [PATCH v3 4/4] staging/lustre/lnet: fix potential null pointer dereference Oleg Drokin
  3 siblings, 0 replies; 5+ messages in thread
From: Oleg Drokin @ 2014-04-28  2:25 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel, devel; +Cc: Dmitry Eremin, Oleg Drokin

From: Dmitry Eremin <dmitry.eremin@intel.com>

Local variable 'hash' is never used
found by Klocwork Insight tool

Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-on: http://review.whamcloud.com/9386
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4629
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Isaac Huang <he.huang@intel.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
 drivers/staging/lustre/lnet/lnet/api-ni.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c
index 85b8d81..3f1fdaa 100644
--- a/drivers/staging/lustre/lnet/lnet/api-ni.c
+++ b/drivers/staging/lustre/lnet/lnet/api-ni.c
@@ -127,8 +127,7 @@ lnet_create_remote_nets_table(void)
 static void
 lnet_destroy_remote_nets_table(void)
 {
-	int		i;
-	struct list_head	*hash;
+	int i;
 
 	if (the_lnet.ln_remote_nets_hash == NULL)
 		return;
@@ -137,7 +136,8 @@ lnet_destroy_remote_nets_table(void)
 		LASSERT(list_empty(&the_lnet.ln_remote_nets_hash[i]));
 
 	LIBCFS_FREE(the_lnet.ln_remote_nets_hash,
-		    LNET_REMOTE_NETS_HASH_SIZE * sizeof(*hash));
+		    LNET_REMOTE_NETS_HASH_SIZE *
+		    sizeof(the_lnet.ln_remote_nets_hash[0]));
 	the_lnet.ln_remote_nets_hash = NULL;
 }
 
-- 
1.9.0


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

* [PATCH v3 3/4] staging/lustre/lnet: fix potential null pointer dereference in kiblnd_rejected
  2014-04-28  2:25 [PATCH v3 0/4] Lustre Klocwork fixes Oleg Drokin
  2014-04-28  2:25 ` [PATCH v3 1/4] staging/lustre/lnet: Drop useless LASSERT in ksocknal_select_ips Oleg Drokin
  2014-04-28  2:25 ` [PATCH v3 2/4] staging/lustre/lnet: remove unused variable in lnet_destroy_remote_nets_table Oleg Drokin
@ 2014-04-28  2:25 ` Oleg Drokin
  2014-04-28  2:25 ` [PATCH v3 4/4] staging/lustre/lnet: fix potential null pointer dereference Oleg Drokin
  3 siblings, 0 replies; 5+ messages in thread
From: Oleg Drokin @ 2014-04-28  2:25 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel, devel; +Cc: Dmitry Eremin, Oleg Drokin

From: Dmitry Eremin <dmitry.eremin@intel.com>

Null pointer 'cp' that comes from line 2544 may be dereferenced
at line 2618.
found by Klocwork Insight tool

Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-on: http://review.whamcloud.com/9386
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4629
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Isaac Huang <he.huang@intel.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
 drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
index 6173e74..9bf6c94 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
@@ -2609,13 +2609,17 @@ kiblnd_rejected (kib_conn_t *conn, int reason, void *priv, int priv_nob)
 
 			case IBLND_REJECT_MSG_QUEUE_SIZE:
 				CERROR("%s rejected: incompatible message queue depth %d, %d\n",
-				       libcfs_nid2str(peer->ibp_nid), cp->ibcp_queue_depth,
+				       libcfs_nid2str(peer->ibp_nid),
+				       cp != NULL ? cp->ibcp_queue_depth :
+				       IBLND_MSG_QUEUE_SIZE(rej->ibr_version),
 				       IBLND_MSG_QUEUE_SIZE(conn->ibc_version));
 				break;
 
 			case IBLND_REJECT_RDMA_FRAGS:
 				CERROR("%s rejected: incompatible # of RDMA fragments %d, %d\n",
-				       libcfs_nid2str(peer->ibp_nid), cp->ibcp_max_frags,
+				       libcfs_nid2str(peer->ibp_nid),
+				       cp != NULL ? cp->ibcp_max_frags :
+				       IBLND_RDMA_FRAGS(rej->ibr_version),
 				       IBLND_RDMA_FRAGS(conn->ibc_version));
 				break;
 
-- 
1.9.0


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

* [PATCH v3 4/4] staging/lustre/lnet: fix potential null pointer dereference
  2014-04-28  2:25 [PATCH v3 0/4] Lustre Klocwork fixes Oleg Drokin
                   ` (2 preceding siblings ...)
  2014-04-28  2:25 ` [PATCH v3 3/4] staging/lustre/lnet: fix potential null pointer dereference in kiblnd_rejected Oleg Drokin
@ 2014-04-28  2:25 ` Oleg Drokin
  3 siblings, 0 replies; 5+ messages in thread
From: Oleg Drokin @ 2014-04-28  2:25 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel, devel
  Cc: Oleg Drokin, Oleg Drokin, Dmitry Eremin, Liang Zhen

Pointer 'ni' checked for NULL at line 1569 may be passed to
function and may be dereferenced there by passing argument 1 to
function 'lnet_ni_notify_locked' at line 1621.
found by Klocwork Insight tool

Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
CC: Dmitry Eremin <dmitry.eremin@intel.com>
CC: Liang Zhen <liang.zhen@intel.com>
---
 drivers/staging/lustre/lnet/lnet/router.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c
index 995f509..926923a 100644
--- a/drivers/staging/lustre/lnet/lnet/router.c
+++ b/drivers/staging/lustre/lnet/lnet/router.c
@@ -145,7 +145,7 @@ lnet_ni_notify_locked(lnet_ni_t *ni, lnet_peer_t *lp)
 	 * NB individual events can be missed; the only guarantee is that you
 	 * always get the most recent news */
 
-	if (lp->lp_notifying)
+	if (lp->lp_notifying || ni == NULL)
 		return;
 
 	lp->lp_notifying = 1;
-- 
1.9.0


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

end of thread, other threads:[~2014-04-28  2:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-28  2:25 [PATCH v3 0/4] Lustre Klocwork fixes Oleg Drokin
2014-04-28  2:25 ` [PATCH v3 1/4] staging/lustre/lnet: Drop useless LASSERT in ksocknal_select_ips Oleg Drokin
2014-04-28  2:25 ` [PATCH v3 2/4] staging/lustre/lnet: remove unused variable in lnet_destroy_remote_nets_table Oleg Drokin
2014-04-28  2:25 ` [PATCH v3 3/4] staging/lustre/lnet: fix potential null pointer dereference in kiblnd_rejected Oleg Drokin
2014-04-28  2:25 ` [PATCH v3 4/4] staging/lustre/lnet: fix potential null pointer dereference Oleg Drokin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.