From: Dan Carpenter <dan.carpenter@oracle.com>
To: Souptick Joarder <jrdr.linux@gmail.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>,
Mina Almasry <almasrymina@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
David Rientjes <rientjes@google.com>,
Linux-MM <linux-mm@kvack.org>,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] hugetlb: Fix an error code in hugetlb_reserve_pages()
Date: Mon, 14 Dec 2020 06:30:21 +0000 [thread overview]
Message-ID: <20201214063021.GA2809@kadam> (raw)
In-Reply-To: <CAFqt6zYtQ0BR_KZjJsicmmGDT1WYyYYOHqEVe1Vd5ZWLBSAVWA@mail.gmail.com>
On Sat, Dec 12, 2020 at 01:19:28AM +0530, Souptick Joarder wrote:
> Hi Dan,
>
> On Fri, Dec 11, 2020 at 3:44 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> >
> > Preserve the error code from region_add() instead of returning success.
> >
> > Fixes: 0db9d74ed884 ("hugetlb: disable region_add file_region coalescing")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> > From static analysis. Untested.
> >
> > mm/hugetlb.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> > index 1f3bf1710b66..ac2e48b9f1d7 100644
> > --- a/mm/hugetlb.c
> > +++ b/mm/hugetlb.c
> > @@ -5113,6 +5113,7 @@ int hugetlb_reserve_pages(struct inode *inode,
> >
> > if (unlikely(add < 0)) {
> > hugetlb_acct_memory(h, -gbl_reserve);
> > + ret = add;
>
> This function returns int but ret is long type.
> Does it need correction ?
>
It doesn't *need* correction. The code works fine as-is. Smatch parses
it correctly, also. Hard to say if making it "ret" makes the code
simpler or more complicated for a human reader.
regards,
dan carpenter
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Souptick Joarder <jrdr.linux@gmail.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>,
Mina Almasry <almasrymina@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
David Rientjes <rientjes@google.com>,
Linux-MM <linux-mm@kvack.org>,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] hugetlb: Fix an error code in hugetlb_reserve_pages()
Date: Mon, 14 Dec 2020 09:30:21 +0300 [thread overview]
Message-ID: <20201214063021.GA2809@kadam> (raw)
In-Reply-To: <CAFqt6zYtQ0BR_KZjJsicmmGDT1WYyYYOHqEVe1Vd5ZWLBSAVWA@mail.gmail.com>
On Sat, Dec 12, 2020 at 01:19:28AM +0530, Souptick Joarder wrote:
> Hi Dan,
>
> On Fri, Dec 11, 2020 at 3:44 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> >
> > Preserve the error code from region_add() instead of returning success.
> >
> > Fixes: 0db9d74ed884 ("hugetlb: disable region_add file_region coalescing")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> > From static analysis. Untested.
> >
> > mm/hugetlb.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> > index 1f3bf1710b66..ac2e48b9f1d7 100644
> > --- a/mm/hugetlb.c
> > +++ b/mm/hugetlb.c
> > @@ -5113,6 +5113,7 @@ int hugetlb_reserve_pages(struct inode *inode,
> >
> > if (unlikely(add < 0)) {
> > hugetlb_acct_memory(h, -gbl_reserve);
> > + ret = add;
>
> This function returns int but ret is long type.
> Does it need correction ?
>
It doesn't *need* correction. The code works fine as-is. Smatch parses
it correctly, also. Hard to say if making it "ret" makes the code
simpler or more complicated for a human reader.
regards,
dan carpenter
next prev parent reply other threads:[~2020-12-14 6:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-11 10:13 [PATCH] hugetlb: Fix an error code in hugetlb_reserve_pages() Dan Carpenter
2020-12-11 10:13 ` Dan Carpenter
2020-12-11 19:49 ` Souptick Joarder
2020-12-11 19:52 ` Souptick Joarder
2020-12-11 21:45 ` Matthew Wilcox
2020-12-14 6:30 ` Dan Carpenter [this message]
2020-12-14 6:30 ` Dan Carpenter
2020-12-14 9:37 ` David Hildenbrand
2020-12-14 9:37 ` David Hildenbrand
2020-12-14 19:27 ` Mike Kravetz
2020-12-14 19:27 ` Mike Kravetz
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=20201214063021.GA2809@kadam \
--to=dan.carpenter@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=almasrymina@google.com \
--cc=jrdr.linux@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=rientjes@google.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.