From patchwork Tue Jul 15 11:43:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Bernat X-Patchwork-Id: 369972 X-Patchwork-Delegate: michael@ellerman.id.au Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C5629140144 for ; Tue, 15 Jul 2014 21:44:53 +1000 (EST) Received: from ozlabs.org (ozlabs.org [103.22.144.67]) by lists.ozlabs.org (Postfix) with ESMTP id B20A51A0C8C for ; Tue, 15 Jul 2014 21:44:53 +1000 (EST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from bart.luffy.cx (unknown [IPv6:2a01:4f8:130:64e3::7]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3E15F1A014E for ; Tue, 15 Jul 2014 21:44:13 +1000 (EST) Received: from bart.luffy.cx (localhost [127.0.0.1]) by bart.luffy.cx (Postfix) with ESMTP id 7F434143D9; Tue, 15 Jul 2014 13:44:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha1; c=simple; d=luffy.cx; h=from:to:cc :subject:date:message-id:in-reply-to:references; s=postfix; bh=I 5N2YujtpqtCUFl6oVbCrvLH9x8=; b=rxthMe8Q5szpR9kjt/Pb5yQOVrMXBmlB3 TvcTO7LRdIv5QtZFu6032QTIpI5sEgwA8JK+SBc0Of3NHoQDCbxiPhPyFOwJAdim zTbO5zWrPtv2z3CjKHEeQrHriNqG5L4NGp6IIpz/zMnagkWCdIVYPX47RD0XSYLM fWR8tuYEyE= Received: from neo.luffy.cx (unknown [IPv6:2a01:e34:ec6d:710:468a:5bff:fe5c:219d]) by bart.luffy.cx (Postfix) with ESMTPS id 40CBE141D6; Tue, 15 Jul 2014 13:44:06 +0200 (CEST) Received: by neo.luffy.cx (Postfix, from userid 500) id 4874A577; Tue, 15 Jul 2014 13:44:05 +0200 (CEST) From: Vincent Bernat To: David Laight , Benjamin Herrenschmidt , Paul Mackerras , "linuxppc-dev@lists.ozlabs.org" Subject: [PATCH] ppc/xmon: use isspace/isxdigit/isalnum from linux/ctype.h Date: Tue, 15 Jul 2014 13:43:47 +0200 Message-Id: <1405424627-31411-1-git-send-email-vincent@bernat.im> X-Mailer: git-send-email 2.0.1 In-Reply-To: References: Cc: Vincent Bernat X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" isxdigit() macro definition is the same. isalnum() from linux/ctype.h will accept additional latin non-ASCII characters. This is harmless since this macro is used in scanhex() which parses user input. isspace() from linux/ctype.h will accept vertical tab and form feed but not NULL. The use of this macro is modified to accept NULL as well. Additional characters are harmless since this macro is also only used in scanhex(). Signed-off-by: Vincent Bernat --- arch/powerpc/xmon/xmon.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index d199bfa2f1fa..55d9b48774b7 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -177,14 +178,6 @@ extern void xmon_leave(void); #define GETWORD(v) (((v)[0] << 24) + ((v)[1] << 16) + ((v)[2] << 8) + (v)[3]) #endif -#define isxdigit(c) (('0' <= (c) && (c) <= '9') \ - || ('a' <= (c) && (c) <= 'f') \ - || ('A' <= (c) && (c) <= 'F')) -#define isalnum(c) (('0' <= (c) && (c) <= '9') \ - || ('a' <= (c) && (c) <= 'z') \ - || ('A' <= (c) && (c) <= 'Z')) -#define isspace(c) (c == ' ' || c == '\t' || c == 10 || c == 13 || c == 0) - static char *help_string = "\ Commands:\n\ b show breakpoints\n\ @@ -2121,9 +2114,6 @@ static void dump_pacas(void) } #endif -#define isxdigit(c) (('0' <= (c) && (c) <= '9') \ - || ('a' <= (c) && (c) <= 'f') \ - || ('A' <= (c) && (c) <= 'F')) static void dump(void) { @@ -2526,7 +2516,7 @@ scanhex(unsigned long *vp) int i; for (i=0; i<63; i++) { c = inchar(); - if (isspace(c)) { + if (isspace(c) || c == '\0') { termch = c; break; }