[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1459336290.5907.39.camel@linux.intel.com>
Date: Wed, 30 Mar 2016 14:11:30 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Kees Cook <keescook@...omium.org>, James Morris <jmorris@...ei.org>
Cc: "Serge E. Hallyn" <serge@...lyn.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Kalle Valo <kvalo@...eaurora.org>,
Mauro Carvalho Chehab <mchehab@....samsung.com>,
Joe Perches <joe@...ches.com>,
Guenter Roeck <linux@...ck-us.net>,
Jiri Slaby <jslaby@...e.com>, Paul Moore <pmoore@...hat.com>,
Stephen Smalley <sds@...ho.nsa.gov>,
Mimi Zohar <zohar@...ux.vnet.ibm.com>,
Casey Schaufler <casey@...aufler-ca.com>,
Andreas Gruenbacher <agruenba@...hat.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Ulf Hansson <ulf.hansson@...aro.org>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
linux-security-module@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/5] string_helpers: add kstrdup_quotable_cmdline
On Wed, 2016-03-30 at 14:07 +0300, Andy Shevchenko wrote:
> On Mon, 2016-03-28 at 14:14 -0700, Kees Cook wrote:
> > + res = get_cmdline(task, buffer, PAGE_SIZE - 1);
> > + buffer[res] = '\0';
> > +
> > + /* Collapse trailing NULLs. */
> > + for (; res > 0; res--)
> > + if (buffer[res-1] != '\0')
> > + break;
> /* buffer[res] is '\0', so, predecrement is safe here */
> while (buffer[--res] == '\0')
> /* nothing */;
>
> ?
>
Oops, no, the following should be better
while (--res >= 0 && buffer[res] == '\0') ;
--
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Intel Finland Oy
Powered by blists - more mailing lists