Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f1cb9d68 authored by Salvatore Mesoraca's avatar Salvatore Mesoraca Committed by David S. Miller
Browse files

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: default avatarSalvatore Mesoraca <s.mesoraca16@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3ed898e8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
+3 −0
Original line number Diff line number Diff line
@@ -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));
}

+1 −0
Original line number Diff line number Diff line
@@ -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)