Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp268236ybk; Sat, 9 May 2020 02:17:12 -0700 (PDT) X-Google-Smtp-Source: APiQypKTXQ9vd37KSBl01XqVYikdZF36r4kVlh4dlLCGtJfcHmUVRFw8OWHnTnFqL/D6OFVT1ISj X-Received: by 2002:a17:906:5795:: with SMTP id k21mr496589ejq.374.1589015831849; Sat, 09 May 2020 02:17:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589015831; cv=none; d=google.com; s=arc-20160816; b=FJi2fB+90+5bGrKO3E28PVTXYPq0u2LWCdxrFAfUbsh3DzgSX8qcV+I4fZBI+dB0ZE zZwbfsanFVB9ijUA28GWv2FjhfYwWtwhhEaYkCwgdM8II45iuBkAY960oQSSYc5UBzoc 5lFbbCbq5rpKouttybrNyAvJNsya6kHBFBfz4iBCo1BwKz3JVhQ+zliImxY6RkSotxuR OjgfMb0DHNNiHJ7HBUK6L9fLV2BSbbcVM1P85NhR2WqTrGrp880aHK2hKxfFtAk9FMGz KWU4eK0x1gWD7jf3d3lwWDDLngkq/f4lnRtNAPnBqjy4FkpdLWy9OQdS4FEFFDzN5j/z fVmA== 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=4A8CosBCkzHnKmLYN1DybjFGn9/wiE3eiewD/oXB0WY=; b=WNyi8pJ10DV+bMLHJDAgln1Nq4GoxTUAF0dr7HwhnTelbaaNjSg6D01HCd4QlfFoVo NxE8q5GHQdyUh4umP6LuseTij0Dh5eSTbpuc/UGoGaw8pbkYKa84oCTO2LlTJfa1cP5K jwiy6aI/LiHL5eLuukoc8t7VBFqtxlJ7yPDw2uRVx5sWLIR0rM84eYiFhKBmECRFzPba xbyHLbJ1qOA2h47/0ajIVnAQ27yjMxuhCJ9MK+xciN/2L3GDYTbPBGSUbFqxYz7H/m/X wOkDF9sEbGGnR01JMU8m70lo3vSz923pGSLcQ6ZnqTU4NCcIckdA+HqbklEMFBoY6xwN ENSA== 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 j1si2303726ejg.178.2020.05.09.02.16.49; Sat, 09 May 2020 02:17:11 -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 S1728090AbgEIJPS (ORCPT + 99 others); Sat, 9 May 2020 05:15:18 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:4315 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727951AbgEIJPO (ORCPT ); Sat, 9 May 2020 05:15:14 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 5FE4CD6C5CCEE7F7E696; Sat, 9 May 2020 17:15:11 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.487.0; Sat, 9 May 2020 17:15:02 +0800 From: Chen Zhou To: CC: , , Subject: [PATCH -next 1/2] sparc: use snprintf() in show_pciobppath_attr() in pci.c Date: Sat, 9 May 2020 17:18:48 +0800 Message-ID: <20200509091849.116954-2-chenzhou10@huawei.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200509091849.116954-1-chenzhou10@huawei.com> References: <20200509091849.116954-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. show_pciobppath_attr() should return the number of bytes printed into the buffer. This is the return value of scnprintf(). Signed-off-by: Chen Zhou --- arch/sparc/kernel/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c index 5ed43828e078..a41ad562ed4e 100644 --- a/arch/sparc/kernel/pci.c +++ b/arch/sparc/kernel/pci.c @@ -593,7 +593,7 @@ show_pciobppath_attr(struct device * dev, struct device_attribute * attr, char * pdev = to_pci_dev(dev); dp = pdev->dev.of_node; - return snprintf (buf, PAGE_SIZE, "%pOF\n", dp); + return scnprintf(buf, PAGE_SIZE, "%pOF\n", dp); } static DEVICE_ATTR(obppath, S_IRUSR | S_IRGRP | S_IROTH, show_pciobppath_attr, NULL); -- 2.20.1