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@xxxxxxxxxx> 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@xxxxxxxxxx> > > --- > > 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