diff options
author | Salvatore Mesoraca <s.mesoraca16@gmail.com> | 2018-03-11 22:07:49 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-03-12 15:06:59 -0400 |
commit | f1cb9d68b4d8789d7f48bd293772095430860d86 (patch) | |
tree | 238171f3f41d78691100707d296c3612aaa8ab28 /net/rds | |
parent | 3ed898e8cd0588152d9f0d7f472387c4af7f640e (diff) |
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
Signed-off-by: Salvatore Mesoraca <s.mesoraca16@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rds')
-rw-r--r-- | net/rds/connection.c | 2 | ||||
-rw-r--r-- | net/rds/ib.c | 3 | ||||
-rw-r--r-- | net/rds/rds.h | 1 |
3 files changed, 5 insertions, 1 deletions
diff --git a/net/rds/connection.c b/net/rds/connection.c index 2da3176bf792..f80792c719eb 100644 --- a/net/rds/connection.c +++ b/net/rds/connection.c @@ -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; diff --git a/net/rds/ib.c b/net/rds/ib.c index 50a88f3e7e39..02deee29e7f1 100644 --- a/net/rds/ib.c +++ b/net/rds/ib.c @@ -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)); } diff --git a/net/rds/rds.h b/net/rds/rds.h index 74cd27c661de..b04c333d9d1c 100644 --- a/net/rds/rds.h +++ b/net/rds/rds.h @@ -735,6 +735,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) |