From: Kyle Spiers <kyle@spiers.me> To: idryomov@gmail.com Cc: sage@redhat.com, elder@kernel.org, ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org, keescook@chromium.org Subject: [PATCH] rbd: Remove VLA usage Date: Fri, 9 Mar 2018 21:14:31 -0800 [thread overview] Message-ID: <744974f1-d9b3-9fc1-621d-f4b5d3e806b6@spiers.me> (raw) >From 4198ebe2e8058ff676d8e2f993d8806d6ca29c11 Mon Sep 17 00:00:00 2001 From: Kyle Spiers <kyle@spiers.me> Date: Fri, 9 Mar 2018 12:34:15 -0800 Subject: [PATCH] rbd: Remove VLA usage As part of the effort to remove VLAs from the kernel[1], this moves the literal values into the stack array calculation instead of using a variable for the sizing. The resulting size can be found from sizeof(buf). [1] https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Kyle Spiers <kyle@spiers.me> --- drivers/block/rbd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 8e40da0..0e94e1f 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -3100,8 +3100,8 @@ static int __rbd_notify_op_lock(struct rbd_device *rbd_dev, { struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc; struct rbd_client_id cid = rbd_get_cid(rbd_dev); - int buf_size = 4 + 8 + 8 + CEPH_ENCODING_START_BLK_LEN; - char buf[buf_size]; + char buf[4 + 4 + 8 + 8 + CEPH_ENCODING_START_BLK_LEN]; + int buf_size = sizeof(buf); void *p = buf; dout("%s rbd_dev %p notify_op %d\n", __func__, rbd_dev, notify_op); @@ -3619,8 +3619,8 @@ 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]; + char buf[4 + CEPH_ENCODING_START_BLK_LEN]; + int buf_size = sizeof(buf); int ret; if (result) { -- 2.7.4
WARNING: multiple messages have this Message-ID (diff)
From: Kyle Spiers <kyle@spiers.me> To: idryomov@gmail.com Cc: sage@redhat.com, elder@kernel.org, ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org, keescook@chromium.org Subject: [PATCH] rbd: Remove VLA usage Date: Fri, 9 Mar 2018 21:14:31 -0800 [thread overview] Message-ID: <744974f1-d9b3-9fc1-621d-f4b5d3e806b6@spiers.me> (raw) From 4198ebe2e8058ff676d8e2f993d8806d6ca29c11 Mon Sep 17 00:00:00 2001 From: Kyle Spiers <kyle@spiers.me> Date: Fri, 9 Mar 2018 12:34:15 -0800 Subject: [PATCH] rbd: Remove VLA usage As part of the effort to remove VLAs from the kernel[1], this moves the literal values into the stack array calculation instead of using a variable for the sizing. The resulting size can be found from sizeof(buf). [1] https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Kyle Spiers <kyle@spiers.me> --- drivers/block/rbd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 8e40da0..0e94e1f 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -3100,8 +3100,8 @@ static int __rbd_notify_op_lock(struct rbd_device *rbd_dev, { struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc; struct rbd_client_id cid = rbd_get_cid(rbd_dev); - int buf_size = 4 + 8 + 8 + CEPH_ENCODING_START_BLK_LEN; - char buf[buf_size]; + char buf[4 + 4 + 8 + 8 + CEPH_ENCODING_START_BLK_LEN]; + int buf_size = sizeof(buf); void *p = buf; dout("%s rbd_dev %p notify_op %d\n", __func__, rbd_dev, notify_op); @@ -3619,8 +3619,8 @@ 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]; + char buf[4 + CEPH_ENCODING_START_BLK_LEN]; + int buf_size = sizeof(buf); int ret; if (result) { -- 2.7.4
next reply other threads:[~2018-03-10 5:21 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-03-10 5:14 Kyle Spiers [this message] 2018-03-10 5:14 ` [PATCH] rbd: Remove VLA usage Kyle Spiers 2018-03-10 15:24 ` Kees Cook 2018-03-12 9:45 ` Ilya Dryomov 2018-03-30 19:17 [PATCH] rbd: remove " Gustavo A. R. Silva 2018-03-30 20:29 ` Ilya Dryomov 2018-03-30 20:34 ` Gustavo A. R. Silva
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=744974f1-d9b3-9fc1-621d-f4b5d3e806b6@spiers.me \ --to=kyle@spiers.me \ --cc=ceph-devel@vger.kernel.org \ --cc=elder@kernel.org \ --cc=idryomov@gmail.com \ --cc=keescook@chromium.org \ --cc=linux-kernel@vger.kernel.org \ --cc=sage@redhat.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.