From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1764328AbdEWTjK (ORCPT ); Tue, 23 May 2017 15:39:10 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:42684 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757295AbdEWTjH (ORCPT ); Tue, 23 May 2017 15:39:07 -0400 Date: Tue, 23 May 2017 21:38:55 +0200 From: Greg Kroah-Hartman To: =?iso-8859-1?Q?Rapha=EBl?= Beamonte Cc: Oleg Drokin , devel@driverdev.osuosl.org, Sebastien Buisson , Hongchao Zhang , Fan Yong , linux-kernel@vger.kernel.org, Aditya Pandit , Andreas Dilger , "John L. Hammond" , lustre-devel@lists.lustre.org Subject: Re: [PATCH] drivers: staging: lustre: replace variable length array by dynamic allocation Message-ID: <20170523193855.GA11862@kroah.com> References: <8c04ebb67ffbc9482cc6170e9bd29ec513766218.1495567933.git.raphael.beamonte@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <8c04ebb67ffbc9482cc6170e9bd29ec513766218.1495567933.git.raphael.beamonte@gmail.com> User-Agent: Mutt/1.8.2 (2017-04-18) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 23, 2017 at 09:32:13PM +0200, Raphaël Beamonte wrote: > Fixes the following sparse warnings: > > drivers/staging/lustre/lustre/llite/xattr.c:89:62: warning: Variable > length array is used. > drivers/staging/lustre/lustre/llite/xattr.c:366:62: warning: Variable > length array is used. > > Signed-off-by: Raphaël Beamonte > --- > drivers/staging/lustre/lustre/llite/xattr.c | 24 ++++++++++++++++++++---- > 1 file changed, 20 insertions(+), 4 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c > index 6187bffec8c4..ccfc728d8ec0 100644 > --- a/drivers/staging/lustre/lustre/llite/xattr.c > +++ b/drivers/staging/lustre/lustre/llite/xattr.c > @@ -86,7 +86,7 @@ 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]; > + char *fullname; > struct ll_sb_info *sbi = ll_i2sbi(inode); > struct ptlrpc_request *req = NULL; > const char *pv = value; > @@ -140,10 +140,18 @@ ll_xattr_set_common(const struct xattr_handler *handler, > return -EPERM; > } > > + fullname = kmalloc(strlen(handler->prefix) + strlen(name) + 1, > + GFP_KERNEL); > + if (!fullname) > + return -ENOMEM; > + > sprintf(fullname, "%s%s\n", handler->prefix, name); > rc = md_setxattr(sbi->ll_md_exp, ll_inode2fid(inode), > valid, fullname, pv, size, 0, flags, > ll_i2suppgid(inode), &req); > + > + kfree(fullname); Didn't we reject much this same patch last week? thanks, greg k-h