From: Prashant Bhole Date: Wed, 6 Dec 2017 01:47:04 +0000 (+0900) Subject: rds: debug: fix null check on static array X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=d9b8693783e8a1ce8e4495d13d1dd6d8081f5070;p=linux.git rds: debug: fix null check on static array 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 Acked-by: Sowmini Varadhan Acked-by: Santosh Shilimkar Signed-off-by: David S. Miller --- diff --git a/net/rds/connection.c b/net/rds/connection.c index 9efc82c665b5a..6492c0b608a43 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