From: Andrew Morton <akpm@linux-foundation.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
tglx@linutronix.de, Enrico Weigelt <info@metux.net>,
Kate Stewart <kstewart@linuxfoundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] mm, vmpressure: Fix a signedness bug in vmpressure_register_event()
Date: Sat, 28 Sep 2019 15:04:10 -0700 [thread overview]
Message-ID: <20190928150410.5964a7935ca1b3cb47a2ae76@linux-foundation.org> (raw)
In-Reply-To: <20190928214702.GA30382@bombadil.infradead.org>
On Sat, 28 Sep 2019 14:47:02 -0700 Matthew Wilcox <willy@infradead.org> wrote:
> On Sat, Sep 28, 2019 at 02:23:56PM -0700, Andrew Morton wrote:
> > How about doing it this way? Only copy the int to the enum once we
> > know it's within range?
>
> This will return a positive integer on success instead of 0. We need:
>
> mutex_unlock(&vmpr->events_lock);
> + ret = 0;
> out:
>
> with that,
>
> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
>
> How about further adding ...
>
> + * Return: 0 on success, -ENOMEM on memory failure or -EINVAL if @args could
> + * not be parsed.
Cool.
--- a/mm/vmpressure.c~mm-vmpressure-fix-a-signedness-bug-in-vmpressure_register_event-fix-fix
+++ a/mm/vmpressure.c
@@ -355,6 +355,9 @@ void vmpressure_prio(gfp_t gfp, struct m
* "hierarchy" or "local").
*
* To be used as memcg event method.
+ *
+ * Return: 0 on success, -ENOMEM on memory failure or -EINVAL if @args could
+ * not be parsed.
*/
int vmpressure_register_event(struct mem_cgroup *memcg,
struct eventfd_ctx *eventfd, const char *args)
@@ -402,6 +405,7 @@ int vmpressure_register_event(struct mem
mutex_lock(&vmpr->events_lock);
list_add(&ev->node, &vmpr->events);
mutex_unlock(&vmpr->events_lock);
+ ret = 0;
out:
kfree(spec_orig);
return ret;
_
next prev parent reply other threads:[~2019-09-28 22:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-25 11:04 Dan Carpenter
2019-09-25 13:07 ` Andy Shevchenko
2019-09-26 19:04 ` David Rientjes
2019-09-28 21:23 ` Andrew Morton
2019-09-28 21:47 ` Matthew Wilcox
2019-09-28 22:04 ` Andrew Morton [this message]
2019-10-01 7:20 ` Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190928150410.5964a7935ca1b3cb47a2ae76@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=dan.carpenter@oracle.com \
--cc=gregkh@linuxfoundation.org \
--cc=info@metux.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=kstewart@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=tglx@linutronix.de \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox