net: rds: drop VLA in rds_for_each_conn_info()
Subsystems (4)
PATCH 1/2 net: rds: drop VLA in rds_for_each_conn_info()
Avoid VLA[1] by using an already allocated buffer passed by the caller.
[1] https://lkml.org/lkml/2018/3/7/621
--- net/rds/connection.c | 2 +- net/rds/ib.c | 3 +++ net/rds/rds.h | 1 + 3 files changed, 5 insertions(+), 1 deletion(-)
net/rds/connection.c +1 -1
@@ -540,9 +540,9 @@ void rds_for_each_conn_info(struct socket *sock, unsigned int len,struct rds_info_iterator *iter, struct rds_info_lengths *lens, int (*visitor)(struct rds_connection *, void *), + u64 *buffer, size_t item_len) { - uint64_t buffer[(item_len + 7) / 8]; struct hlist_head *head;struct rds_connection *conn;size_t i;
net/rds/ib.c +3 -0
@@ -321,8 +321,11 @@ static void rds_ib_ic_info(struct socket *sock, unsigned int len,struct rds_info_iterator *iter, struct rds_info_lengths *lens) { + u64 buffer[(sizeof(struct rds_info_rdma_connection) + 7) / 8]; +rds_for_each_conn_info (sock, len, iter, lens, rds_ib_conn_info_visitor, + buffer,sizeof (struct rds_info_rdma_connection )); }
net/rds/rds.h +1 -0
@@ -709,6 +709,7 @@ void rds_for_each_conn_info(struct socket *sock, unsigned int len,struct rds_info_iterator *iter, struct rds_info_lengths *lens, int (*visitor)(struct rds_connection *, void *), + u64 *buffer, size_t item_len);__printf (2 ,3 )
Signature · 1 line
1.9.1
PATCH 2/2 net: rds: drop VLA in rds_walk_conn_path_info()
Avoid VLA[1] by using an already allocated buffer passed by the caller.
[1] https://lkml.org/lkml/2018/3/7/621
--- net/rds/connection.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/rds/connection.c +4 -1
@@ -578,9 +578,9 @@ static void rds_walk_conn_path_info(struct socket *sock, unsigned int len,struct rds_info_iterator *iter, struct rds_info_lengths *lens, int (*visitor)(struct rds_conn_path *, void *), + u64 *buffer, size_t item_len) { - u64 buffer[(item_len + 7) / 8]; struct hlist_head *head;struct rds_connection *conn;size_t i;
@@ -649,8 +649,11 @@ static void rds_conn_info(struct socket *sock, unsigned int len,struct rds_info_iterator *iter, struct rds_info_lengths *lens) { + u64 buffer[(sizeof(struct rds_info_connection) + 7) / 8]; +rds_walk_conn_path_info (sock, len, iter, lens, rds_conn_info_visitor, + buffer,sizeof (struct rds_info_connection )); }
Signature · 1 line
1.9.1
Quoted 7 lines · Salvatore Mesoraca
Avoid VLA[1] by using an already allocated buffer passed by the caller.
[1] https://lkml.org/lkml/2018/3/7/621
Signed-off-by Salvatore Mesoraca <[email protected]>---
Thanks for both VLA fixes Salvatore.
FWIW, Acked-by: Santosh Shilimkar <[email protected]>
Re: [PATCH 2/2] net: rds: drop VLA in rds_walk_conn_path_info()
In reply to Salvatore MesoracaQuoted 7 lines · Salvatore Mesoraca
Avoid VLA[1] by using an already allocated buffer passed by the caller.
[1] https://lkml.org/lkml/2018/3/7/621
Signed-off-by Salvatore Mesoraca <[email protected]>---
2018-03-12 8:06 GMT+01:00 [email protected] <[email protected]>:
Quoted 5 lines · Salvatore Mesoraca
Quoted 4 lines
Avoid VLA[1] by using an already allocated buffer passed by the caller.
Quoted 8 lines
Quoted 4 lines
[1] https://lkml.org/lkml/2018/3/7/621
Signed-off-by Salvatore Mesoraca <[email protected]>---
Thanks for both VLA fixes Salvatore.
FWIW, Acked-by: Santosh Shilimkar <[email protected]>
Thank you very much for your time,
Salvatore
From: Salvatore Mesoraca <[email protected]>
Date: Sun, 11 Mar 2018 22:07:49 +0100
Quoted 6 lines
Avoid VLA[1] by using an already allocated buffer passed by the caller.
[1] https://lkml.org/lkml/2018/3/7/621
Signed-off-by Salvatore Mesoraca <[email protected]>
Applied.
David Miller
maintainerRe: [PATCH 2/2] net: rds: drop VLA in rds_walk_conn_path_info()
In reply to Salvatore MesoracaFrom: Salvatore Mesoraca <[email protected]>
Date: Sun, 11 Mar 2018 22:07:50 +0100
Quoted 6 lines
Avoid VLA[1] by using an already allocated buffer passed by the caller.
[1] https://lkml.org/lkml/2018/3/7/621
Signed-off-by Salvatore Mesoraca <[email protected]>
Also applied, thanks.