From: Matthew Wilcox <willy@infradead.org>
To: Souptick Joarder <jrdr.linux@gmail.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
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: Fri, 11 Dec 2020 21:45:52 +0000 [thread overview]
Message-ID: <20201211214552.GC2443@casper.infradead.org> (raw)
In-Reply-To: <CAFqt6zYtQ0BR_KZjJsicmmGDT1WYyYYOHqEVe1Vd5ZWLBSAVWA@mail.gmail.com>
On Sat, Dec 12, 2020 at 01:19:28AM +0530, Souptick Joarder wrote:
> > @@ -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 ?
I wouold say "no", because 'ret' isn't returned _by_ this function (*),
its purpose is to capture the return value from other functions.
(*) OK, it is, if ret < 0. But ret < 0 really means "Is this an error
number", which can be perfectly well represented in an int, short or long.
char is too small ;-)
So the range of values which will be placed in 'ret' is (-4096-LONG_MAX]
next prev parent reply other threads:[~2020-12-11 21:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-11 10:13 Dan Carpenter
2020-12-11 19:49 ` Souptick Joarder
2020-12-11 21:45 ` Matthew Wilcox [this message]
2020-12-14 6:30 ` Dan Carpenter
2020-12-14 9:37 ` David Hildenbrand
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=20201211214552.GC2443@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=almasrymina@google.com \
--cc=dan.carpenter@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox