lkml.org 
[lkml]   [2018]   [Jun]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] proc: save 2 atomic ops on write to "/proc/*/attr/*"
On Wed, Jun 27, 2018 at 11:02 PM, Alexey Dobriyan <adobriyan@gmail.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

\
 
 \ /
  Last update: 2018-06-27 23:43    [W:0.106 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site