Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1637151
| From | Joe Perches <joe@perches.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2] staging: lustre: llite: Fix variable length array warning |
| Date | 2017-05-08 01:30 +0200 |
| Message-ID | <tEDMK-4eZ-17@gated-at.bofh.it> (permalink) |
| References | <tEDto-46D-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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?
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2] staging: lustre: llite: Fix variable length array warning Guru Das Srinagesh <gurooodas@gmail.com> - 2017-05-08 01:10 +0200
Re: [PATCH v2] staging: lustre: llite: Fix variable length array warning Joe Perches <joe@perches.com> - 2017-05-08 01:30 +0200
Re: [PATCH v2] staging: lustre: llite: Fix variable length array warning Guru Das Srinagesh <gurooodas@gmail.com> - 2017-05-08 02:10 +0200
csiph-web