[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHp75Vcp61v_VeMNrKYwpc7MKXy2Mjcx9kek-oPyX8A+P7ci1w@mail.gmail.com>
Date: Thu, 28 Jun 2018 00:42:34 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Alexey Dobriyan <adobriyan@...il.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-security-module <linux-security-module@...r.kernel.org>
Subject: Re: [PATCH] proc: save 2 atomic ops on write to "/proc/*/attr/*"
On Wed, Jun 27, 2018 at 11:02 PM, Alexey Dobriyan <adobriyan@...il.com> wrote:
> Code checks if write is done by current to its own attributes.
> For that get/put pair is unnecessary as it can be done under RCU.
> /* No partial writes. */
> - length = -EINVAL;
> if (*ppos != 0)
> - goto out;
> + return -EINVAL;
>
> page = memdup_user(buf, count);
> if (IS_ERR(page)) {
> - length = PTR_ERR(page);
> + rv = PTR_ERR(page);
> goto out;
You alredy have more than one exit location, why not to convert this
one as well and get rid of out label completely?
> }
> out_free:
> kfree(page);
> out:
> + return rv;
> }
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists