mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: "Raphaël Beamonte" <raphael.beamonte@gmail.com>
Cc: Oleg Drokin <oleg.drokin@intel.com>,
	devel@driverdev.osuosl.org,
	Sebastien Buisson <sebastien.buisson@bull.net>,
	Hongchao Zhang <hongchao.zhang@intel.com>,
	Fan Yong <fan.yong@intel.com>,
	linux-kernel@vger.kernel.org,
	Aditya Pandit <panditadityashreesh@yahoo.com>,
	Andreas Dilger <andreas.dilger@intel.com>,
	"John L. Hammond" <john.hammond@intel.com>,
	lustre-devel@lists.lustre.org
Subject: Re: [PATCH] drivers: staging: lustre: replace variable length array by dynamic allocation
Date: Tue, 23 May 2017 21:38:55 +0200	[thread overview]
Message-ID: <20170523193855.GA11862@kroah.com> (raw)
In-Reply-To: <8c04ebb67ffbc9482cc6170e9bd29ec513766218.1495567933.git.raphael.beamonte@gmail.com>

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 <raphael.beamonte@gmail.com>
> ---
>  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

  reply	other threads:[~2017-05-23 19:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-23 19:32 Raphaël Beamonte
2017-05-23 19:38 ` Greg Kroah-Hartman [this message]
2017-05-27 18:23   ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170523193855.GA11862@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=andreas.dilger@intel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=fan.yong@intel.com \
    --cc=hongchao.zhang@intel.com \
    --cc=john.hammond@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lustre-devel@lists.lustre.org \
    --cc=oleg.drokin@intel.com \
    --cc=panditadityashreesh@yahoo.com \
    --cc=raphael.beamonte@gmail.com \
    --cc=sebastien.buisson@bull.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome