From: Salvatore Mesoraca <s.mesoraca16@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: kernel-hardening@lists.openwall.com, linux-rdma@vger.kernel.org,
netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Kees Cook <keescook@chromium.org>,
Salvatore Mesoraca <s.mesoraca16@gmail.com>,
Santosh Shilimkar <santosh.shilimkar@oracle.com>
Subject: [PATCH 2/2] net: rds: drop VLA in rds_walk_conn_path_info()
Date: Sun, 11 Mar 2018 22:07:50 +0100 [thread overview]
Message-ID: <1520802470-17374-2-git-send-email-s.mesoraca16@gmail.com> (raw)
In-Reply-To: <1520802470-17374-1-git-send-email-s.mesoraca16@gmail.com>
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>
---
net/rds/connection.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/rds/connection.c b/net/rds/connection.c
index f80792c..abef75d 100644
--- a/net/rds/connection.c
+++ b/net/rds/connection.c
@@ -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));
}
--
1.9.1
next prev parent reply other threads:[~2018-03-11 21:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-11 21:07 [PATCH 1/2] net: rds: drop VLA in rds_for_each_conn_info() Salvatore Mesoraca
2018-03-11 21:07 ` Salvatore Mesoraca [this message]
2018-03-12 7:06 ` [PATCH 2/2] net: rds: drop VLA in rds_walk_conn_path_info() santosh.shilimkar
2018-03-12 19:08 ` David Miller
2018-03-12 7:06 ` [PATCH 1/2] net: rds: drop VLA in rds_for_each_conn_info() santosh.shilimkar
2018-03-12 10:12 ` Salvatore Mesoraca
2018-03-12 19:07 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1520802470-17374-2-git-send-email-s.mesoraca16@gmail.com \
--to=s.mesoraca16@gmail.com \
--cc=davem@davemloft.net \
--cc=keescook@chromium.org \
--cc=kernel-hardening@lists.openwall.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=santosh.shilimkar@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox