From nobody Tue Feb 10 04:23:43 2026 Received: from out-174.mta1.migadu.com (out-174.mta1.migadu.com [95.215.58.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4746E221F1C for ; Sun, 8 Feb 2026 09:27:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770542857; cv=none; b=maa7miYKp5d3Lv3mTckkZiT1Bw7oSEUTggV2CBm5fB5vQnt4A2D6B28gRP0kqD3ff65xF4Jj8YI1kwCtQne0iY3NaZxa/4EHsJ1yvYOE29BIhXoiqhDIuw5MBYjJ+1sDSDcJqHtG8AHN+bU9viAhGLk5W+NSBdhDwe5mmHeOitc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770542857; c=relaxed/simple; bh=ql36eZjf2Hp8ftpME0qTlJjK8vonhHM+3K6Hi9Ss3iA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=HRv9xv0adfda9n4+6CxZiN2qrRbWVxB/5/7lkhQbQJ/P071PjgM+7aCbywWNBWg/8KmSg+xoTkvd5iRQMGtEeu4443tRGxx2KBzyGkyoGaT80xBsq1iGNDwoNmpKtS7jFeWD1SKf+y1CBVPw8Ppn19tQU7TD1zLnB38NNDEvw4w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=YDZk43T/; arc=none smtp.client-ip=95.215.58.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="YDZk43T/" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1770542854; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=BltP21DZjH+jxJUxQg6H58ROoHC9sfcwA06UtM64JaE=; b=YDZk43T/6Nbez8DjZBMNnXQnFRI+IV+7Gdby5ahJnztie5S4r96nDZ3P564oFt6plNwyX5 kCgXJouy35CvoCZubKweW7LICVe5Xbv6L2HpDA6THQwYbwRGH/cON9xBOvvN8EU9qStdKq stWOxSEHHB2J/g/vYjGz9pj7FAZlQNE= From: Thorsten Blum To: "David S. Miller" , Andreas Larsson Cc: Thorsten Blum , sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] sparc: vio: Use sysfs_emit in sysfs show functions Date: Sun, 8 Feb 2026 10:26:55 +0100 Message-ID: <20260208092656.95613-2-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Replace sprintf() and scnprintf() with sysfs_emit() in sysfs show functions. sysfs_emit() is preferred to format sysfs output as it provides better bounds checking. Signed-off-by: Thorsten Blum --- arch/sparc/kernel/vio.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/sparc/kernel/vio.c b/arch/sparc/kernel/vio.c index 8c7dd72ef334..f9375f7b0bbb 100644 --- a/arch/sparc/kernel/vio.c +++ b/arch/sparc/kernel/vio.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -121,7 +122,7 @@ static ssize_t devspec_show(struct device *dev, else if (!strcmp(vdev->type, "vdc-port")) str =3D "vdisk"; =20 - return sprintf(buf, "%s\n", str); + return sysfs_emit(buf, "%s\n", str); } static DEVICE_ATTR_RO(devspec); =20 @@ -129,7 +130,7 @@ static ssize_t type_show(struct device *dev, struct device_attribute *attr, char *buf) { struct vio_dev *vdev =3D to_vio_dev(dev); - return sprintf(buf, "%s\n", vdev->type); + return sysfs_emit(buf, "%s\n", vdev->type); } static DEVICE_ATTR_RO(type); =20 @@ -138,7 +139,7 @@ static ssize_t modalias_show(struct device *dev, struct= device_attribute *attr, { const struct vio_dev *vdev =3D to_vio_dev(dev); =20 - return sprintf(buf, "vio:T%sS%s\n", vdev->type, vdev->compat); + return sysfs_emit(buf, "vio:T%sS%s\n", vdev->type, vdev->compat); } static DEVICE_ATTR_RO(modalias); =20 @@ -192,7 +193,7 @@ show_pciobppath_attr(struct device *dev, struct device_= attribute *attr, vdev =3D to_vio_dev(dev); dp =3D vdev->dp; =20 - return scnprintf(buf, PAGE_SIZE, "%pOF\n", dp); + return sysfs_emit(buf, "%pOF\n", dp); } =20 static DEVICE_ATTR(obppath, S_IRUSR | S_IRGRP | S_IROTH, --=20 Thorsten Blum GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4