LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v3] rbd: Remove VLA usage
@ 2018-03-17 16:44 Kyle Spiers
2018-03-20 15:01 ` Ilya Dryomov
0 siblings, 1 reply; 2+ messages in thread
From: Kyle Spiers @ 2018-03-17 16:44 UTC (permalink / raw)
To: idryomov; +Cc: sage, elder, ceph-devel, linux-kernel, keescook, me, Kyle Spiers
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..46893e0 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 + 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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v3] rbd: Remove VLA usage
2018-03-17 16:44 [PATCH v3] rbd: Remove VLA usage Kyle Spiers
@ 2018-03-20 15:01 ` Ilya Dryomov
0 siblings, 0 replies; 2+ messages in thread
From: Ilya Dryomov @ 2018-03-20 15:01 UTC (permalink / raw)
To: Kyle Spiers
Cc: Sage Weil, Alex Elder, Ceph Development, linux-kernel, Kees Cook,
Tobin C. Harding
On Sat, Mar 17, 2018 at 5:44 PM, Kyle Spiers <kyle@spiers.me> wrote:
>
> 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..46893e0 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 + 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) {
Applied.
Thanks,
Ilya
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-20 15:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-17 16:44 [PATCH v3] rbd: Remove VLA usage Kyle Spiers
2018-03-20 15:01 ` Ilya Dryomov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).