Re: [PATCH v2 2/2] hugetlb: Fix return value of __setup handlers

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

 



On 01.04.22 12:12, Peng Liu wrote:
> When __setup() return '0', using invalid option values causes the
> entire kernel boot option string to be reported as Unknown. Hugetlb
> calls __setup() and will return '0' when set invalid parameter
> string.
> 
> The following phenomenon is observed:
>  cmdline:
>   hugepagesz=1Y hugepages=1
>  dmesg:
>   HugeTLB: unsupported hugepagesz=1Y
>   HugeTLB: hugepages=1 does not follow a valid hugepagesz, ignoring
>   Unknown kernel command line parameters "hugepagesz=1Y hugepages=1"
> 
> Since hugetlb will print warn or error information before return for
> invalid parameter string, just use return '1' to avoid print again.
> 
> Signed-off-by: Peng Liu <liupeng256@xxxxxxxxxx>
> ---
>  mm/hugetlb.c | 18 ++++++++----------
>  1 file changed, 8 insertions(+), 10 deletions(-)
> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 9cd746432ca9..6dde34c115c9 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -4131,12 +4131,11 @@ static int __init hugepages_setup(char *s)
>  	int count;
>  	unsigned long tmp;
>  	char *p = s;
> -	int ret = 1;

Adding this in #1 to remove it in #2 is a bit sub-optimal IMHO.


-- 
Thanks,

David / dhildenb




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux