Skip to content

Commit b2c9272

Browse files
smesodavem330
authored andcommitted
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 Signed-off-by: Salvatore Mesoraca <[email protected]> Acked-by: Santosh Shilimkar <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f1cb9d6 commit b2c9272

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

net/rds/connection.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,9 +578,9 @@ static void rds_walk_conn_path_info(struct socket *sock, unsigned int len,
578578
struct rds_info_iterator *iter,
579579
struct rds_info_lengths *lens,
580580
int (*visitor)(struct rds_conn_path *, void *),
581+
u64 *buffer,
581582
size_t item_len)
582583
{
583-
u64 buffer[(item_len + 7) / 8];
584584
struct hlist_head *head;
585585
struct rds_connection *conn;
586586
size_t i;
@@ -649,8 +649,11 @@ static void rds_conn_info(struct socket *sock, unsigned int len,
649649
struct rds_info_iterator *iter,
650650
struct rds_info_lengths *lens)
651651
{
652+
u64 buffer[(sizeof(struct rds_info_connection) + 7) / 8];
653+
652654
rds_walk_conn_path_info(sock, len, iter, lens,
653655
rds_conn_info_visitor,
656+
buffer,
654657
sizeof(struct rds_info_connection));
655658
}
656659

0 commit comments

Comments
 (0)