Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp256054ybk; Sat, 9 May 2020 01:55:21 -0700 (PDT) X-Google-Smtp-Source: APiQypLUEFdFvYEaQ9doUrvA5QAmP90KDCOn9Zkm7GCaxTAmQXjxDYwCX1ddSuBYhcZwXNhZRjNG X-Received: by 2002:aa7:d718:: with SMTP id t24mr5349582edq.20.1589014521442; Sat, 09 May 2020 01:55:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589014521; cv=none; d=google.com; s=arc-20160816; b=mXKRLkFUn8FozhQSoj21yOelw5xQMeSETLnr/5HHUCOaDih8WRh5HHBXL77ldcFqAs kYBbnVejWMJRep3SxQDUF1kMJp8s4ruojF1CEG5gTdZtz1HR1ABgKyxFGSUDxG56KIl2 CIQBqN0OXksz09nud1i1btms/WidyWHn12wHeMc4SqsK0JTJuUAp+5GPx2uUAlVw/qEI mdKV/EbjNhpy7pQ6nT4KOf+9wgOCvLybC8lmxaEgBeILHAmz8aCHr/V23FRzu4e1Qgh8 QMa1Yo2LO6eFoOYRmDrNGL+c5RKH7th4cOdVCKPuyMSEs0P9GVBfYQZS/psiu6qaVAm6 s2kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=FOyHdXPyUFK4hIs2HDa2kqtDcsHhrcxhdOjhkONWBIg=; b=fP0aIAGekEKUhYqJ2SoveCQYwREL0QzKSOkHwRI8K/Bd/D2IL8DQHFNmxPsEwhNbIa L3aQFNIDTP7GFlL0mtyQG99AbkrQQwZSy3B70m2c2o856WKp4bvQRzWf+a2r0qmU0tC/ 0f/+e2ycmk5esE61PgHpLaa73896+zyuq590z6g6uXeWipBlXAvTWxa5wtbMorB1NKfq M073Kk8/CLSKHymJusuCsRFIU1aeprIh+uhKZs6VcJSQHzKPOxzE9gjwCdrnd4OM/Dur l4A5qQmqIuC32tzDTMvmpDEYMOKJkbKbRc6B3SRhwQRHWKqKlBFatTcp+lxJtXxhvN53 45hA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y8si1620411ejq.247.2020.05.09.01.54.58; Sat, 09 May 2020 01:55:21 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727863AbgEIIwd (ORCPT + 99 others); Sat, 9 May 2020 04:52:33 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:56030 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727835AbgEIIwd (ORCPT ); Sat, 9 May 2020 04:52:33 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 21A63F014332F74A895D; Sat, 9 May 2020 16:52:32 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.487.0; Sat, 9 May 2020 16:52:25 +0800 From: Chen Zhou To: , , CC: , , Subject: [PATCH -next 3/3] s390/protvirt: use scnprintf() instead of snprintf() Date: Sat, 9 May 2020 16:56:08 +0800 Message-ID: <20200509085608.41061-4-chenzhou10@huawei.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200509085608.41061-1-chenzhou10@huawei.com> References: <20200509085608.41061-1-chenzhou10@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org snprintf() returns the number of bytes that would be written, which may be greater than the the actual length to be written. uv_query_facilities() should return the number of bytes printed into the buffer. This is the return value of scnprintf(). The other functions are the same. Signed-off-by: Chen Zhou --- arch/s390/kernel/uv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/s390/kernel/uv.c b/arch/s390/kernel/uv.c index 4c0677fc8904..e7ea82a2bf63 100644 --- a/arch/s390/kernel/uv.c +++ b/arch/s390/kernel/uv.c @@ -331,7 +331,7 @@ EXPORT_SYMBOL_GPL(arch_make_page_accessible); static ssize_t uv_query_facilities(struct kobject *kobj, struct kobj_attribute *attr, char *page) { - return snprintf(page, PAGE_SIZE, "%lx\n%lx\n%lx\n%lx\n", + return scnprintf(page, PAGE_SIZE, "%lx\n%lx\n%lx\n%lx\n", uv_info.inst_calls_list[0], uv_info.inst_calls_list[1], uv_info.inst_calls_list[2], @@ -344,7 +344,7 @@ static struct kobj_attribute uv_query_facilities_attr = static ssize_t uv_query_max_guest_cpus(struct kobject *kobj, struct kobj_attribute *attr, char *page) { - return snprintf(page, PAGE_SIZE, "%d\n", + return scnprintf(page, PAGE_SIZE, "%d\n", uv_info.max_guest_cpus); } @@ -354,7 +354,7 @@ static struct kobj_attribute uv_query_max_guest_cpus_attr = static ssize_t uv_query_max_guest_vms(struct kobject *kobj, struct kobj_attribute *attr, char *page) { - return snprintf(page, PAGE_SIZE, "%d\n", + return scnprintf(page, PAGE_SIZE, "%d\n", uv_info.max_num_sec_conf); } @@ -364,7 +364,7 @@ static struct kobj_attribute uv_query_max_guest_vms_attr = static ssize_t uv_query_max_guest_addr(struct kobject *kobj, struct kobj_attribute *attr, char *page) { - return snprintf(page, PAGE_SIZE, "%lx\n", + return scnprintf(page, PAGE_SIZE, "%lx\n", uv_info.max_sec_stor_addr); } -- 2.20.1