All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] rds: debug: fix null check on static array
@ 2017-12-06  1:47 Prashant Bhole
  2017-12-06 11:32 ` Sowmini Varadhan
       [not found] ` <20171206014704.3796-1-bhole_prashant_q7-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org>
  0 siblings, 2 replies; 4+ messages in thread
From: Prashant Bhole @ 2017-12-06  1:47 UTC (permalink / raw)
  To: David S . Miller
  Cc: Prashant Bhole, netdev, Santosh Shilimkar, linux-rdma, rds-devel

t_name cannot be NULL since it is an array field of a struct.
Replacing null check on static array with string length check using
strnlen()

Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
---
 net/rds/connection.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/rds/connection.c b/net/rds/connection.c
index 9efc82c665b5..6492c0b608a4 100644
--- a/net/rds/connection.c
+++ b/net/rds/connection.c
@@ -230,8 +230,8 @@ static struct rds_connection *__rds_conn_create(struct net *net,
 
 	rdsdebug("allocated conn %p for %pI4 -> %pI4 over %s %s\n",
 	  conn, &laddr, &faddr,
-	  trans->t_name ? trans->t_name : "[unknown]",
-	  is_outgoing ? "(outgoing)" : "");
+	  strnlen(trans->t_name, sizeof(trans->t_name)) ? trans->t_name :
+	  "[unknown]", is_outgoing ? "(outgoing)" : "");
 
 	/*
 	 * Since we ran without holding the conn lock, someone could
-- 
2.13.6

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

end of thread, other threads:[~2017-12-06 20:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-06  1:47 [PATCH net-next] rds: debug: fix null check on static array Prashant Bhole
2017-12-06 11:32 ` Sowmini Varadhan
2017-12-06 16:36   ` Santosh Shilimkar
     [not found] ` <20171206014704.3796-1-bhole_prashant_q7-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org>
2017-12-06 20:03   ` David Miller

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.