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: lustre-devel@lists.lustre.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: [lustre-devel] [PATCH v2] staging: lustre: llite: Fix variable length array warning
Date: Sun, 07 May 2017 16:24:51 -0700 [thread overview]
Message-ID: <1494199491.31950.52.camel@perches.com> (raw)
In-Reply-To: <1494149009-2121-1-git-send-email-gurooodas@gmail.com>
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?
WARNING: multiple messages have this Message-ID (diff)
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: 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, 07 May 2017 16:24:51 -0700 [thread overview]
Message-ID: <1494199491.31950.52.camel@perches.com> (raw)
In-Reply-To: <1494149009-2121-1-git-send-email-gurooodas@gmail.com>
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?
next prev parent reply other threads:[~2017-05-07 23:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-07 9:23 [lustre-devel] [PATCH v2] staging: lustre: llite: Fix variable length array warning Guru Das Srinagesh
2017-05-07 9:23 ` Guru Das Srinagesh
2017-05-07 23:24 ` Joe Perches [this message]
2017-05-07 23:24 ` Joe Perches
2017-05-07 23:59 ` [lustre-devel] " Guru Das Srinagesh
2017-05-07 23:59 ` 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=1494199491.31950.52.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=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.