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: <4A29182D.5040003@linux.vnet.ibm.com>
Date:	Fri, 05 Jun 2009 15:05:49 +0200
From:	Peter Oberparleiter <oberpar@...ux.vnet.ibm.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
CC:	linux-kernel@...r.kernel.org, andi@...stfloor.org,
	ying.huang@...el.com, W.Li@....COM, michaele@....ibm.com,
	mingo@...e.hu, heicars2@...ux.vnet.ibm.com,
	mschwid2@...ux.vnet.ibm.com
Subject: Re: [PATCH 3/4] gcov: add gcov profiling infrastructure

Andrew Morton wrote:
> On Wed, 03 Jun 2009 17:26:22 +0200
> Peter Oberparleiter <oberpar@...ux.vnet.ibm.com> wrote:
> --- a/kernel/gcov/fs.c~gcov-add-gcov-profiling-infrastructure-update
> +++ a/kernel/gcov/fs.c
> @@ -70,15 +70,8 @@ static int gcov_persist = 1;
> 
>  static int __init gcov_persist_setup(char *str)
>  {
> -	int val;
> -	char delim;
> -
> -	if (sscanf(str, "%d %c", &val, &delim) != 1) {
> -		pr_warning("invalid gcov_persist parameter '%s'\n", str);
> -		return 0;
> -	}
> -	pr_info("setting gcov_persist to %d\n", val);
> -	gcov_persist = val;
> +	gcov_persist = simple_strtoul(str, NULL, 0);
> +	pr_info("setting gcov_persist to %d\n", gcov_persist);
> 
>  	return 1;
>  }
> _
> 
> arguably we should use strict_strtoul(), but the kernel is a lot less
> fussy about boot parameters than it is with sysfs writes, etc.  If you
> fat-finger your grub.conf, you lose and we don't tell you.

To improve user-friendliness a bit:

Subject: gcov: use strict_strtoul

From: Peter Oberparleiter <oberpar@...ux.vnet.ibm.com>

Use strict_strtoul to identify kernel parameter format errors.

Signed-off-by: Peter Oberparleiter <oberpar@...ux.vnet.ibm.com>
---
 kernel/gcov/fs.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Index: linux-2.6.30-rc8-mm1/kernel/gcov/fs.c
===================================================================
--- linux-2.6.30-rc8-mm1.orig/kernel/gcov/fs.c
+++ linux-2.6.30-rc8-mm1/kernel/gcov/fs.c
@@ -70,7 +70,13 @@ static int gcov_persist = 1;
 
 static int __init gcov_persist_setup(char *str)
 {
-	gcov_persist = simple_strtoul(str, NULL, 0);
+	unsigned long val;
+
+	if (strict_strtoul(str, 0, &val)) {
+		pr_warning("invalid gcov_persist parameter '%s'\n", str);
+		return 0;
+	}
+	gcov_persist = val;
 	pr_info("setting gcov_persist to %d\n", gcov_persist);
 
 	return 1;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ