[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHp75Ve4qDiuGsiy_7XiCvqrAG89R0xt6M_QH2HPKqiYjQ0YbQ@mail.gmail.com>
Date: Sat, 27 May 2017 21:23:54 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Raphaël Beamonte <raphael.beamonte@...il.com>,
Oleg Drokin <oleg.drokin@...el.com>,
devel@...verdev.osuosl.org,
Sebastien Buisson <sebastien.buisson@...l.net>,
Hongchao Zhang <hongchao.zhang@...el.com>,
Fan Yong <fan.yong@...el.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Aditya Pandit <panditadityashreesh@...oo.com>,
Andreas Dilger <andreas.dilger@...el.com>,
"John L. Hammond" <john.hammond@...el.com>,
lustre-devel@...ts.lustre.org
Subject: Re: [PATCH] drivers: staging: lustre: replace variable length array
by dynamic allocation
On Tue, May 23, 2017 at 10:38 PM, Greg Kroah-Hartman
<gregkh@...uxfoundation.org> wrote:
> On Tue, May 23, 2017 at 09:32:13PM +0200, Raphaël Beamonte wrote:
>> 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.
>> + 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?
...besides the fact that kasprintf(); might be better in cases when
malloc + snprintf is used.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists