From: Guru Das Srinagesh <gurooodas@gmail.com>
To: Joe Perches <joe@perches.com>
Cc: oleg.drokin@intel.com, andreas.dilger@intel.com,
jsimmons@infradead.org, gregkh@linuxfoundation.org,
lustre-devel@lists.lustre.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] staging: lustre: llite: Fix variable length array warning
Date: Sun, 7 May 2017 16:59:46 -0700 [thread overview]
Message-ID: <20170507235946.GA2898@alpha> (raw)
In-Reply-To: <1494199491.31950.52.camel@perches.com>
On Sun, May 07, 2017 at 04:24:51PM -0700, Joe Perches wrote:
> On Sun, 2017-05-07 at 02:23 -0700, Guru Das Srinagesh wrote:
> > Fix sparse warning "warning: Variable length array is used." by using
> > kmalloc_array to allocate the required amount of memory instead and
> > kfree to deallocate memory after use.
> []
> > diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c
> []
> > @@ -86,13 +86,17 @@ 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];
> > + int fullname_len = strlen(handler->prefix) + strlen(name) + 1;
> > + char *fullname = kmalloc_array(fullname_len, sizeof(char), GFP_KERNEL);
>
> Are you sure about using GFP_KERNEL and that sleeping is
> allowed for this function allocation?
>
I'm not sure about that. Would GFP_ATOMIC be a better flag to use?
prev parent reply other threads:[~2017-05-07 23:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-07 9:23 [PATCH v2] staging: lustre: llite: Fix variable length array warning Guru Das Srinagesh
2017-05-07 23:24 ` Joe Perches
2017-05-07 23:59 ` Guru Das Srinagesh [this message]
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=20170507235946.GA2898@alpha \
--to=gurooodas@gmail.com \
--cc=andreas.dilger@intel.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=joe@perches.com \
--cc=jsimmons@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lustre-devel@lists.lustre.org \
--cc=oleg.drokin@intel.com \
/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