* [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
* Re: [PATCH net-next] rds: debug: fix null check on static array
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>
1 sibling, 1 reply; 4+ messages in thread
From: Sowmini Varadhan @ 2017-12-06 11:32 UTC (permalink / raw)
To: Prashant Bhole
Cc: David S . Miller, netdev, Santosh Shilimkar, linux-rdma, rds-devel
On (12/06/17 10:47), Prashant Bhole wrote:
>
> 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()
t_name is always initialized for all rds transports today, and would
be all zeros unless someone stomped over that memory (in which case
there could be more serious issues than a busted debug string) but
it's good to be safe and check I suppose.
Acked-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
--Sowmini
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] rds: debug: fix null check on static array
2017-12-06 11:32 ` Sowmini Varadhan
@ 2017-12-06 16:36 ` Santosh Shilimkar
0 siblings, 0 replies; 4+ messages in thread
From: Santosh Shilimkar @ 2017-12-06 16:36 UTC (permalink / raw)
To: Sowmini Varadhan, Prashant Bhole
Cc: David S . Miller, netdev, linux-rdma, rds-devel
On 12/6/2017 3:32 AM, Sowmini Varadhan wrote:
> On (12/06/17 10:47), Prashant Bhole wrote:
>>
>> 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()
>
> t_name is always initialized for all rds transports today, and would
> be all zeros unless someone stomped over that memory (in which case
> there could be more serious issues than a busted debug string) but
> it's good to be safe and check I suppose.
Thanks Sowmini !!
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] rds: debug: fix null check on static array
[not found] ` <20171206014704.3796-1-bhole_prashant_q7-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org>
@ 2017-12-06 20:03 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2017-12-06 20:03 UTC (permalink / raw)
To: bhole_prashant_q7-Zyj7fXuS5i5L9jVzuh4AOg
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA,
linux-rdma-u79uwXL29TY76Z2rM5mHXA,
rds-devel-N0ozoZBvEnrZJqsBc5GL+g
From: Prashant Bhole <bhole_prashant_q7-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org>
Date: Wed, 6 Dec 2017 10:47:04 +0900
> 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-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org>
Applied, thank you.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [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.