lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200313005500.GB5764@carbon.DHCP.thefacebook.com>
Date:   Thu, 12 Mar 2020 17:55:00 -0700
From:   Roman Gushchin <guro@...com>
To:     Qian Cai <cai@....pw>
CC:     Andrew Morton <akpm@...ux-foundation.org>,
        Michal Hocko <mhocko@...nel.org>, <linux-mm@...ck.org>,
        <kernel-team@...com>, <linux-kernel@...r.kernel.org>,
        Rik van Riel <riel@...riel.com>,
        Andreas Schaufler <andreas.schaufler@....de>,
        Mike Kravetz <mike.kravetz@...cle.com>
Subject: Re: [PATCH v3] mm: hugetlb: optionally allocate gigantic hugepages
 using cma

On Thu, Mar 12, 2020 at 09:33:20AM -0400, Qian Cai wrote:
> On Wed, 2020-03-11 at 15:09 -0700, Roman Gushchin wrote:
> > +#ifdef CONFIG_CMA
> > +static unsigned long hugetlb_cma_size __initdata;
> > +
> > +static int __init cmdline_parse_hugetlb_cma(char *p)
> > +{
> > +	unsigned long long val;
> > +	char *endptr;
> > +
> > +	if (!p)
> > +		return -EINVAL;
> > +
> > +	val = simple_strtoull(p, &endptr, 0);
> > +	hugetlb_cma_size = memparse(p, &p);
> > +	return 0;
> > +}
> > +
> 
> Here will generate a compilation warning,
> 
> mm/hugetlb.c: In function 'cmdline_parse_hugetlb_cma':
> mm/hugetlb.c:5548:21: warning: variable 'val' set but not used [-Wunused-but-
> set-variable]
>   unsigned long long val;
>                      ^~~
> Also, the comments for simple_strtoull() in lib/vsprintf.c said,
> 
> "This function is obsolete. Please use kstrtoull instead."
> 

Hello Qian!

Thank you, you're absolutely right.
The following patch should solve both problems:

--

>From d45741afdb9a760e48915c2d19e750f53019e19c Mon Sep 17 00:00:00 2001
From: Roman Gushchin <guro@...com>
Date: Thu, 12 Mar 2020 17:40:04 -0700
Subject: [PATCH] mm: cleanup cmdline_parse_hugetlb_cma()

Remove unused code.

Signed-off-by: Roman Gushchin <guro@...com>
---
 mm/hugetlb.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 66bfc2bdc203..7a20cae7c77a 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -5409,13 +5409,6 @@ static unsigned long hugetlb_cma_size __initdata;
 
 static int __init cmdline_parse_hugetlb_cma(char *p)
 {
-       unsigned long long val;
-       char *endptr;
-
-       if (!p)
-               return -EINVAL;
-
-       val = simple_strtoull(p, &endptr, 0);
        hugetlb_cma_size = memparse(p, &p);
        return 0;
 }
-- 
2.24.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ