From nobody Sun Feb 8 18:30:29 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1557309046; cv=none; d=zoho.com; s=zohoarc; b=Xy/51ukhcz0cSMhxjf7Braf0HPh00vzU+IN6Ros29t31c9liDrqwJwItvnONNRNp83ZcvH8jUZrImtE3tUk+kuap+/pyeTTUPwrc8Hp0rQmmLWCz/TxGwiR1mUTGq2oi4N6UWHmV28itGB9el+n0hUr5YAUZ4VZevjuu3OB9gLk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557309046; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=NSudrnS3PFPaOGAZ03LTk25g5XycH3yak8OA8h+DEkQ=; b=ML0sqhdlKEQLRQp4O6yUgDH9PNVTW5SOqcRz4WeAyGbHIykmBImpRAXgMuISH0/+l8R34J7F99C5FAUvd5XQSafwInW1CH87UJiAiII+o49UUzjkFEFMXdlxYY5pxJMybJGXmQFuoq2s8RC3mp+VwY8n9z0dKBrOWM67TEN6eBM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15573090462061020.3534363896163; Wed, 8 May 2019 02:50:46 -0700 (PDT) Received: from localhost ([127.0.0.1]:34053 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOJDi-0005Zk-PK for importer@patchew.org; Wed, 08 May 2019 05:50:38 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51555) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOJCF-0004hm-GY for qemu-devel@nongnu.org; Wed, 08 May 2019 05:49:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hOJCE-00009z-6S for qemu-devel@nongnu.org; Wed, 08 May 2019 05:49:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55096) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hOJCE-00009c-0y; Wed, 08 May 2019 05:49:06 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4AF092CD7E9; Wed, 8 May 2019 09:49:05 +0000 (UTC) Received: from thuth.com (ovpn-116-100.ams2.redhat.com [10.36.116.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB4EB5D9C8; Wed, 8 May 2019 09:49:03 +0000 (UTC) From: Thomas Huth To: cohuck@redhat.com, qemu-s390x@nongnu.org Date: Wed, 8 May 2019 11:48:55 +0200 Message-Id: <20190508094857.21145-2-thuth@redhat.com> In-Reply-To: <20190508094857.21145-1-thuth@redhat.com> References: <20190508094857.21145-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 08 May 2019 09:49:05 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL SUBSYSTEM s390x 1/3] pc-bios/s390-ccw: Clean up harmless misuse of isdigit() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jjherne@linux.ibm.com, borntraeger@de.ibm.com, qemu-devel@nongnu.org, armbru@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Markus Armbruster atoui() and get_index() pass char values to isdigit(). With a standard isdigit(), we'd get undefined behavior when the value is negative. Can't happen as char is unsigned on s390x. Even if it ould, we're actually using isdigit() from pc-bios/s390-ccw/libc.h here, which works fine for negative values. Clean up anyway, just to avoid setting a bad example. Signed-off-by: Markus Armbruster Message-Id: <20190418145355.21100-6-armbru@redhat.com> [thuth: updated the commit message] Signed-off-by: Thomas Huth --- pc-bios/s390-ccw/libc.c | 2 +- pc-bios/s390-ccw/menu.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pc-bios/s390-ccw/libc.c b/pc-bios/s390-ccw/libc.c index a786566c4c..3187923950 100644 --- a/pc-bios/s390-ccw/libc.c +++ b/pc-bios/s390-ccw/libc.c @@ -38,7 +38,7 @@ uint64_t atoui(const char *str) } =20 while (*str) { - if (!isdigit(*str)) { + if (!isdigit(*(unsigned char *)str)) { break; } val =3D val * 10 + *str - '0'; diff --git a/pc-bios/s390-ccw/menu.c b/pc-bios/s390-ccw/menu.c index 82a4ae6315..ce3815b201 100644 --- a/pc-bios/s390-ccw/menu.c +++ b/pc-bios/s390-ccw/menu.c @@ -134,7 +134,7 @@ static int get_index(void) =20 /* Check for erroneous input */ for (i =3D 0; i < len; i++) { - if (!isdigit(buf[i])) { + if (!isdigit((unsigned char)buf[i])) { return -1; } } --=20 2.21.0