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-next>] [day] [month] [year] [list]
Date:	Thu, 03 Nov 2011 14:16:00 +0100
From:	Paul Bolle <pebolle@...cali.nl>
To:	Michal Marek <mmarek@...e.cz>
Cc:	linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] kconfig: accept negative hexadecimals

Kconfig will print a warning when confronted with a negative "hex"
value:
	'number is invalid'

Make this warning disappear for valid negative hexadecimals (ie, valid
hexadecimal numbers that start with a minus sign, optionally followed by
"0x").

Signed-off-by: Paul Bolle <pebolle@...cali.nl>
---
I ran into this while trying some possible cleanups to various "hex"
config entries, for which I needed to add a negative default. Currently
there are no "hex" config entries with a negative default. (I don't know
whether this warning can be triggered any other way.)

This also allows to enter negative values for "hex" config entries.
Apparently that's currently not needed. But these will then show up as
(eg) "0x-ff" in the GUI. Should that be fixed in a separate commit or
should I update this patch?

 scripts/kconfig/symbol.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 071f00c..2b33478 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -551,6 +551,8 @@ bool sym_string_valid(struct symbol *sym, const char *str)
 		}
 		return true;
 	case S_HEX:
+		if (str[0] == '-')
+			str++;
 		if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X'))
 			str += 2;
 		ch = *str++;
-- 
1.7.4.4

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