Re: [PATCH] hugetlb: Fix an error code in hugetlb_reserve_pages()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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]



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux