Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1520400451-11475-3-git-send-email-me@tobin.cc>
Date: Wed,  7 Mar 2018 16:27:31 +1100
From: "Tobin C. Harding" <me@...in.cc>
To: Kernel Hardening <kernel-hardening@...ts.openwall.com>,
	Tycho Andersen <tycho@...ho.ws>
Cc: "Tobin C. Harding" <me@...in.cc>,
	Kees Cook <keescook@...omium.org>,
	Oleg Drokin <oleg.drokin@...el.com>,
	Andreas Dilger <andreas.dilger@...el.com>,
	James Simmons <jsimmons@...radead.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: [RFC 2/2] lustre: use VLA_SAFE

Currently lustre uses a VLA to store a string on the stack.  We can use
the newly define VLA_SAFE macro to make this declaration safer.

Use VLA_SAFE to declare VLA.

Signed-off-by: Tobin C. Harding <me@...in.cc>
---
 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 532384c91447..6f4099cd4afa 100644
--- a/drivers/staging/lustre/lustre/llite/xattr.c
+++ b/drivers/staging/lustre/lustre/llite/xattr.c
@@ -36,6 +36,7 @@
 #include <linux/mm.h>
 #include <linux/xattr.h>
 #include <linux/selinux.h>
+#include <linux/vla.h>
 
 #define DEBUG_SUBSYSTEM S_LLITE
 
@@ -87,12 +88,13 @@ ll_xattr_set_common(const struct xattr_handler *handler,
 		    const char *name, const void *value, size_t size,
 		    int flags)
 {
-	char fullname[strlen(handler->prefix) + strlen(name) + 1];
 	struct ll_sb_info *sbi = ll_i2sbi(inode);
 	struct ptlrpc_request *req = NULL;
 	const char *pv = value;
 	__u64 valid;
 	int rc;
+	int size = strlen(handler->prefix) + strlen(name) + 1;
+	VLA_SAFE(char, fullname, size, VLA_DEFAULT_MAX);
 
 	if (flags == XATTR_REPLACE) {
 		ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_REMOVEXATTR, 1);
-- 
2.7.4

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.