Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1408866pxb; Fri, 1 Oct 2021 10:00:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymZg0bY/w0I5GK4IySIvrBScuLn7PwVT14Ke0GZxvtGK98af1TOrcEMC5G9TNzjHBty2dK X-Received: by 2002:a63:4c5c:: with SMTP id m28mr10406585pgl.67.1633107637399; Fri, 01 Oct 2021 10:00:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633107637; cv=none; d=google.com; s=arc-20160816; b=GaTVzgUozCbOYL5n//LRWTqGacr5gHQb97ZOI/oR/wYozv79m7jLBZQAgCvMSGWHFu XN4sDku3czeTg/74bJ9GkdP5MkWYKShOpogLcSWuogxc2TScc8F0WmmdrzI8mCTFwPpt 7BXeCNTjentCRBb3EfVEAm/N0AxqLy9vCg1d5n+1kBTn/tYo82xi8mT3pM1lyGAXLV0q gstUO19QDoZeRqV/pxUIi0UnDzQwxOeJSxRH4HA2dA3uLNHzM02nF0uZ5ncWzh2XWnkN ztNgp8l3M6WGCpDA2/mwbA7RtXOVXrUTrJszd3cwOADjSNWn2DkafdieXAKrm0CY3Klq 9iYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=lH8piimsHeW/6aXfdknnJwVsUU3tuADB0eIGuLLnc0w=; b=NcXgS98tIpAvQ+iKS2jgcEPtYHVXj6QTjnQH8h/xjHWyRoG+V4+3swreRXoViWncoW XSeghkjjJJDpF9M9kKhmlqLk7dcJfG6geDngYiK5ei87azTgGb1R+oNnXp4u/2BCW06P JMGDjeKYOlqp1URgkzdXxH11i3oZ6Lm/ljqi1GVcap3mfJb3fdbsKAoTmFpY9NHo76wP IlxGbVe6+vPGO4TNKbmK0jNTdlkD92GidlL/hCRfYt4QixtUvBHPdrJFQxlPDo9mQ5ZA 3Vf+9SicatZUtbKBLz/RM/7L2Sf8i0BSXbXC1iDCb+IZsrqc5FeQ/HIr+vtKuDx0ytOP wNuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h76si9136689pfe.184.2021.10.01.10.00.22; Fri, 01 Oct 2021 10:00:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353906AbhJANFJ (ORCPT + 99 others); Fri, 1 Oct 2021 09:05:09 -0400 Received: from mga14.intel.com ([192.55.52.115]:51101 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353738AbhJANFI (ORCPT ); Fri, 1 Oct 2021 09:05:08 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10123"; a="225083923" X-IronPort-AV: E=Sophos;i="5.85,339,1624345200"; d="scan'208";a="225083923" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Oct 2021 06:02:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,339,1624345200"; d="scan'208";a="521031519" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 01 Oct 2021 06:02:02 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id DB7DF177; Fri, 1 Oct 2021 16:02:05 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Heiko Carstens , Vasily Gorbik , Christian Borntraeger Subject: [PATCH v1 1/1] s390: Use string_upper() instead of open coded variant Date: Fri, 1 Oct 2021 16:02:01 +0300 Message-Id: <20211001130201.72545-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use string_upper() from string helper module instead of open coded variant. Signed-off-by: Andy Shevchenko --- arch/s390/mm/cmm.c | 11 ++++------- arch/s390/mm/extmem.c | 21 ++++++++++++--------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c index 1141c8d5c0d0..2203164b39da 100644 --- a/arch/s390/mm/cmm.c +++ b/arch/s390/mm/cmm.c @@ -14,8 +14,8 @@ #include #include #include +#include #include -#include #include #include #include @@ -394,13 +394,10 @@ static int __init cmm_init(void) goto out_sysctl; #ifdef CONFIG_CMM_IUCV /* convert sender to uppercase characters */ - if (sender) { - int len = strlen(sender); - while (len--) - sender[len] = toupper(sender[len]); - } else { + if (sender) + string_upper(sender, sender); + else sender = cmm_default_sender; - } rc = smsg_register_callback(SMSG_PREFIX, cmm_smsg_target); if (rc < 0) diff --git a/arch/s390/mm/extmem.c b/arch/s390/mm/extmem.c index 5060956b8e7d..2c8c5dc52472 100644 --- a/arch/s390/mm/extmem.c +++ b/arch/s390/mm/extmem.c @@ -12,12 +12,12 @@ #include #include +#include #include #include #include #include #include -#include #include #include #include @@ -89,15 +89,18 @@ static int segext_scode = DCSS_SEGEXTX; static void dcss_mkname(char *name, char *dcss_name) { + /* Segment name is limited by 8 characters + NUL */ + char tmp[8 + 1]; int i; - for (i = 0; i < 8; i++) { - if (name[i] == '\0') - break; - dcss_name[i] = toupper(name[i]); - } - for (; i < 8; i++) - dcss_name[i] = ' '; + /* + * This snprintf() call does two things: + * - makes a NUL-terminated copy of the input string + * - pads it with spaces + */ + snprintf(tmp, sizeof(tmp), "%s ", name); + string_upper(dcss_name, tmp); + ASCEBC(dcss_name, 8); } @@ -109,7 +112,7 @@ dcss_mkname(char *name, char *dcss_name) static struct dcss_segment * segment_by_name (char *name) { - char dcss_name[9]; + char dcss_name[8]; struct list_head *l; struct dcss_segment *tmp, *retval = NULL; -- 2.33.0