Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [day] [month] [year] [list]
Date: Mon, 12 Mar 2018 16:00:08 +1100
From: "Tobin C. Harding" <>
To: Ilya Dryomov <>,
	Sage Weil <>,
	Alex Elder <>
Cc: "Tobin C. Harding" <>,,,,
	Tycho Andersen <>,
	Kees Cook <>
Subject: [PATCH] rbd: Remove VLA saving ack buffer size

The kernel would like to have all stack VLA usage removed[1].  Here the
array is declared using a variable that is declared using a constant
statement but the compiler still emits a warning.  We can clear the
warning bu using the constant statement directly.  The buffer size
variable is set to zero on the error path; the buffer size variable is
used later in the function, we can maintain this behavior by setting the
variable using the macro ARRAY_SIZE.

Use constant statement to declare array.


Signed-off-by: Tobin C. Harding <>

Excuse the lack of threading, I forgot the second patch ;)  Can re-send
threaded correctly if required.

 drivers/block/rbd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 927ecd9a2511..7c228753fddd 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -3618,13 +3618,14 @@ static void __rbd_acknowledge_notify(struct rbd_device *rbd_dev,
 				     u64 notify_id, u64 cookie, s32 *result)
 	struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc;
-	int buf_size = 4 + CEPH_ENCODING_START_BLK_LEN;
-	char buf[buf_size];
+	int buf_size;
 	int ret;
 	if (result) {
 		void *p = buf;
+		buf_size = ARRAY_SIZE(buf);
 		/* encode ResponseMessage */
 		ceph_start_encoding(&p, 1, 1,
 				    buf_size - CEPH_ENCODING_START_BLK_LEN);

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.