From: Joe Perches <joe@perches.com>
To: Guru Das Srinagesh <gurooodas@gmail.com>,
oleg.drokin@intel.com, andreas.dilger@intel.com,
jsimmons@infradead.org, gregkh@linuxfoundation.org
Cc: john.hammond@intel.com, lustre-devel@lists.lustre.org,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: lustre: llite: Fix variable length array warning
Date: Fri, 05 May 2017 01:52:36 -0700 [thread overview]
Message-ID: <1493974356.31950.13.camel@perches.com> (raw)
In-Reply-To: <1493966486-6143-1-git-send-email-gurooodas@gmail.com>
On Thu, 2017-05-04 at 23:41 -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,7 +86,8 @@ 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);
What happens when this allocation fails?
next prev parent reply other threads:[~2017-05-05 8:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-05 6:41 [PATCH] staging: lustre: llite: Fix variable length array warning Guru Das Srinagesh
2017-05-05 8:52 ` Joe Perches [this message]
2017-05-06 20:16 ` Guru Das Srinagesh
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=1493974356.31950.13.camel@perches.com \
--to=joe@perches.com \
--cc=andreas.dilger@intel.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=gurooodas@gmail.com \
--cc=john.hammond@intel.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