[PATCH] Fixing sparse warning of variable length array

Lior Pugatch buzz5800 at gmail.com
Thu May 18 20:39:48 UTC 2017


>From c93e5f16090b217d76c0c0b94201a97e0c43c32b Mon Sep 17 00:00:00 2001
From: Lior Pugatch <buzz5800 at gmail.com>
Date: Thu, 18 May 2017 22:49:12 +0300
Subject: [PATCH] Fixing sparse warning of variable length array

Signed-off-by: Lior Pugatch <buzz5800 at gmail.com>
---
 drivers/staging/lustre/lustre/llite/xattr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c
index 6187bff..4e19249 100644
--- a/drivers/staging/lustre/lustre/llite/xattr.c
+++ b/drivers/staging/lustre/lustre/llite/xattr.c
@@ -86,7 +86,9 @@ static int xattr_type_filter(struct ll_sb_info *sbi,
 		    const char *name, const void *value, size_t size,
 		    int flags)
 {
-	char fullname[strlen(handler->prefix) + strlen(name) + 1];
+	const unsigned int prefix_len = strlen(handler->prefix);
+	const unsigned int name_len = strlen(name);
+	char fullname[prefix_len + name_len + 1];
 	struct ll_sb_info *sbi = ll_i2sbi(inode);
 	struct ptlrpc_request *req = NULL;
 	const char *pv = value;
-- 
1.9.1


More information about the devel mailing list