* [PATCH v2] rbd: Remove VLA usage
@ 2018-03-16 4:32 Kyle Spiers
2018-03-16 8:49 ` Ilya Dryomov
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Kyle Spiers @ 2018-03-16 4:32 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..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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] rbd: Remove VLA usage
2018-03-16 4:32 [PATCH v2] rbd: Remove VLA usage Kyle Spiers
@ 2018-03-16 8:49 ` Ilya Dryomov
2018-03-17 5:55 ` kbuild test robot
2018-03-17 7:27 ` kbuild test robot
2 siblings, 0 replies; 4+ messages in thread
From: Ilya Dryomov @ 2018-03-16 8:49 UTC (permalink / raw)
To: Kyle Spiers
Cc: Sage Weil, Alex Elder, Ceph Development, linux-kernel, Kees Cook,
Tobin C. Harding
On Fri, Mar 16, 2018 at 5:32 AM, 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..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];
Where is this extra 4 came from?
> + int buf_size = sizeof(buf)
A semicolon is missing here. Did you compile this patch?
Thanks,
Ilya
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] rbd: Remove VLA usage
2018-03-16 4:32 [PATCH v2] rbd: Remove VLA usage Kyle Spiers
2018-03-16 8:49 ` Ilya Dryomov
@ 2018-03-17 5:55 ` kbuild test robot
2018-03-17 7:27 ` kbuild test robot
2 siblings, 0 replies; 4+ messages in thread
From: kbuild test robot @ 2018-03-17 5:55 UTC (permalink / raw)
To: Kyle Spiers
Cc: kbuild-all, idryomov, sage, elder, ceph-devel, linux-kernel,
keescook, me, Kyle Spiers
[-- Attachment #1: Type: text/plain, Size: 3371 bytes --]
Hi Kyle,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v4.16-rc5 next-20180316]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Kyle-Spiers/rbd-Remove-VLA-usage/20180317-131424
config: i386-randconfig-x017-201810 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
drivers/block/rbd.c: In function '__rbd_notify_op_lock':
>> drivers/block/rbd.c:3105:2: error: expected ',' or ';' before 'void'
void *p = buf;
^~~~
>> drivers/block/rbd.c:3110:23: error: 'p' undeclared (first use in this function); did you mean 'up'?
ceph_start_encoding(&p, 2, 1, buf_size - CEPH_ENCODING_START_BLK_LEN);
^
up
drivers/block/rbd.c:3110:23: note: each undeclared identifier is reported only once for each function it appears in
vim +3105 drivers/block/rbd.c
b30a01f2a Ilya Dryomov 2014-05-22 3095
ed95b21a4 Ilya Dryomov 2016-08-12 3096 static int __rbd_notify_op_lock(struct rbd_device *rbd_dev,
ed95b21a4 Ilya Dryomov 2016-08-12 3097 enum rbd_notify_op notify_op,
ed95b21a4 Ilya Dryomov 2016-08-12 3098 struct page ***preply_pages,
ed95b21a4 Ilya Dryomov 2016-08-12 3099 size_t *preply_len)
b30a01f2a Ilya Dryomov 2014-05-22 3100 {
922dab613 Ilya Dryomov 2016-05-26 3101 struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc;
ed95b21a4 Ilya Dryomov 2016-08-12 3102 struct rbd_client_id cid = rbd_get_cid(rbd_dev);
1910cf8b5 Kyle Spiers 2018-03-15 3103 char buf[4 + 4 + 8 + 8 + CEPH_ENCODING_START_BLK_LEN];
1910cf8b5 Kyle Spiers 2018-03-15 3104 int buf_size = sizeof(buf)
ed95b21a4 Ilya Dryomov 2016-08-12 @3105 void *p = buf;
b30a01f2a Ilya Dryomov 2014-05-22 3106
ed95b21a4 Ilya Dryomov 2016-08-12 3107 dout("%s rbd_dev %p notify_op %d\n", __func__, rbd_dev, notify_op);
b30a01f2a Ilya Dryomov 2014-05-22 3108
ed95b21a4 Ilya Dryomov 2016-08-12 3109 /* encode *LockPayload NotifyMessage (op + ClientId) */
ed95b21a4 Ilya Dryomov 2016-08-12 @3110 ceph_start_encoding(&p, 2, 1, buf_size - CEPH_ENCODING_START_BLK_LEN);
ed95b21a4 Ilya Dryomov 2016-08-12 3111 ceph_encode_32(&p, notify_op);
ed95b21a4 Ilya Dryomov 2016-08-12 3112 ceph_encode_64(&p, cid.gid);
ed95b21a4 Ilya Dryomov 2016-08-12 3113 ceph_encode_64(&p, cid.handle);
76756a51e Ilya Dryomov 2014-06-20 3114
ed95b21a4 Ilya Dryomov 2016-08-12 3115 return ceph_osdc_notify(osdc, &rbd_dev->header_oid,
ed95b21a4 Ilya Dryomov 2016-08-12 3116 &rbd_dev->header_oloc, buf, buf_size,
ed95b21a4 Ilya Dryomov 2016-08-12 3117 RBD_NOTIFY_TIMEOUT, preply_pages, preply_len);
c525f0360 Ilya Dryomov 2016-04-28 3118 }
c525f0360 Ilya Dryomov 2016-04-28 3119
:::::: The code at line 3105 was first introduced by commit
:::::: ed95b21a4b0a71ef89306cdeb427d53cc9cb343f rbd: support for exclusive-lock feature
:::::: TO: Ilya Dryomov <idryomov@gmail.com>
:::::: CC: Ilya Dryomov <idryomov@gmail.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 28656 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] rbd: Remove VLA usage
2018-03-16 4:32 [PATCH v2] rbd: Remove VLA usage Kyle Spiers
2018-03-16 8:49 ` Ilya Dryomov
2018-03-17 5:55 ` kbuild test robot
@ 2018-03-17 7:27 ` kbuild test robot
2 siblings, 0 replies; 4+ messages in thread
From: kbuild test robot @ 2018-03-17 7:27 UTC (permalink / raw)
To: Kyle Spiers
Cc: kbuild-all, idryomov, sage, elder, ceph-devel, linux-kernel,
keescook, me, Kyle Spiers
[-- Attachment #1: Type: text/plain, Size: 3344 bytes --]
Hi Kyle,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v4.16-rc5 next-20180316]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Kyle-Spiers/rbd-Remove-VLA-usage/20180317-131424
config: x86_64-randconfig-s0-03171325 (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
drivers//block/rbd.c: In function '__rbd_notify_op_lock':
drivers//block/rbd.c:3105:2: error: expected ',' or ';' before 'void'
void *p = buf;
^~~~
>> drivers//block/rbd.c:3110:23: error: 'p' undeclared (first use in this function)
ceph_start_encoding(&p, 2, 1, buf_size - CEPH_ENCODING_START_BLK_LEN);
^
drivers//block/rbd.c:3110:23: note: each undeclared identifier is reported only once for each function it appears in
vim +/p +3110 drivers//block/rbd.c
b30a01f2a Ilya Dryomov 2014-05-22 3095
ed95b21a4 Ilya Dryomov 2016-08-12 3096 static int __rbd_notify_op_lock(struct rbd_device *rbd_dev,
ed95b21a4 Ilya Dryomov 2016-08-12 3097 enum rbd_notify_op notify_op,
ed95b21a4 Ilya Dryomov 2016-08-12 3098 struct page ***preply_pages,
ed95b21a4 Ilya Dryomov 2016-08-12 3099 size_t *preply_len)
b30a01f2a Ilya Dryomov 2014-05-22 3100 {
922dab613 Ilya Dryomov 2016-05-26 3101 struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc;
ed95b21a4 Ilya Dryomov 2016-08-12 3102 struct rbd_client_id cid = rbd_get_cid(rbd_dev);
1910cf8b5 Kyle Spiers 2018-03-15 3103 char buf[4 + 4 + 8 + 8 + CEPH_ENCODING_START_BLK_LEN];
1910cf8b5 Kyle Spiers 2018-03-15 3104 int buf_size = sizeof(buf)
ed95b21a4 Ilya Dryomov 2016-08-12 @3105 void *p = buf;
b30a01f2a Ilya Dryomov 2014-05-22 3106
ed95b21a4 Ilya Dryomov 2016-08-12 3107 dout("%s rbd_dev %p notify_op %d\n", __func__, rbd_dev, notify_op);
b30a01f2a Ilya Dryomov 2014-05-22 3108
ed95b21a4 Ilya Dryomov 2016-08-12 3109 /* encode *LockPayload NotifyMessage (op + ClientId) */
ed95b21a4 Ilya Dryomov 2016-08-12 @3110 ceph_start_encoding(&p, 2, 1, buf_size - CEPH_ENCODING_START_BLK_LEN);
ed95b21a4 Ilya Dryomov 2016-08-12 3111 ceph_encode_32(&p, notify_op);
ed95b21a4 Ilya Dryomov 2016-08-12 3112 ceph_encode_64(&p, cid.gid);
ed95b21a4 Ilya Dryomov 2016-08-12 3113 ceph_encode_64(&p, cid.handle);
76756a51e Ilya Dryomov 2014-06-20 3114
ed95b21a4 Ilya Dryomov 2016-08-12 3115 return ceph_osdc_notify(osdc, &rbd_dev->header_oid,
ed95b21a4 Ilya Dryomov 2016-08-12 3116 &rbd_dev->header_oloc, buf, buf_size,
ed95b21a4 Ilya Dryomov 2016-08-12 3117 RBD_NOTIFY_TIMEOUT, preply_pages, preply_len);
c525f0360 Ilya Dryomov 2016-04-28 3118 }
c525f0360 Ilya Dryomov 2016-04-28 3119
:::::: The code at line 3110 was first introduced by commit
:::::: ed95b21a4b0a71ef89306cdeb427d53cc9cb343f rbd: support for exclusive-lock feature
:::::: TO: Ilya Dryomov <idryomov@gmail.com>
:::::: CC: Ilya Dryomov <idryomov@gmail.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31625 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-03-17 7:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-16 4:32 [PATCH v2] rbd: Remove VLA usage Kyle Spiers
2018-03-16 8:49 ` Ilya Dryomov
2018-03-17 5:55 ` kbuild test robot
2018-03-17 7:27 ` kbuild test robot
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).