From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-180.mta1.migadu.com (out-180.mta1.migadu.com [95.215.58.180]) (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 8611C44A71B for ; Tue, 30 Jun 2026 14:54:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782831244; cv=none; b=dOu+ulTPEtj67zdCGNy4eejSpoYp2ZmhkC79KaXTxevJ1A4NcawjkKrsoANGZvcdfBhcEGX7FWZoA+7IIaiePlv3DbYQOGeuBxMImjD5xUOHLVM3QIuQjrkZVLDNmQlxvXaDoEd06mAmqC0pskHFG33qNRV9migBMeAboNTrNd4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782831244; c=relaxed/simple; bh=t07oB5yLhZyHga9z8cC/7C8bbPb64QTclkxfg9I/0aM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Jah/XQcQXqDEydBr39fmSf3n0MvAaXGhhXVopD/UBitIte+u6jokC7FIx5GqoPcLPpKN9+z8ocWKT8yfNALZB7IHNlepeaQfMw3Wu+K8y5ZyOCHvaQCDktfarFxZS4KDBHVCWmdB83y9LmIuQA4ab6D/EWk6aUhRorH4i86tYjA= 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=FscsKqn7; arc=none smtp.client-ip=95.215.58.180 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="FscsKqn7" 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=1782831238; 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=fXgJ6ncg7/LRAI10/ReLeI9PIKurpP1ikYGBLufKO44=; b=FscsKqn7irl88wGVa9gdOOxwcOgW+qbbBsVVGtnEZKHII841uOp3TGq+k/68WD8Alfzm8V lDFwYdb5cc6OyZOpyXErD2HHZ5nvHEiQALy9PbdwgmIR/C6QanxT7J35l1+BGBikEaH5qA 2KQkDrELo/lZVFSzUzs5loqeLKMFWKc= From: Thorsten Blum To: Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , "Christophe Leroy (CS GROUP)" , Kees Cook Cc: Thorsten Blum , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH] powerpc: fsl_rio: Use snprintf() in fsl_rio_setup() Date: Tue, 30 Jun 2026 16:49:50 +0200 Message-ID: <20260630144951.692473-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 X-Developer-Signature: v=1; a=openpgp-sha256; l=792; i=thorsten.blum@linux.dev; h=from:subject; bh=t07oB5yLhZyHga9z8cC/7C8bbPb64QTclkxfg9I/0aM=; b=owGbwMvMwCUWt7pQ4caZUj3G02pJDFnO1/vbN3vvOJzz/2mRcv/ipp0a8keiBcXrljOX9BiuC HnzQbmmo5SFQYyLQVZMkeXBrB8zfEtrKjeZROyEmcPKBDKEgYtTACbyWIXhn9WT13tayt1zqps0 tJdKqlToCYeHLuPOVG/WzOs9Mv1VASPDjTk9tTXbznctvBXxpcPwnOVsm53aWy0in8j9af37/q0 mDwA= X-Developer-Key: i=thorsten.blum@linux.dev; a=openpgp; fpr=1D60735E8AEF3BE473B69D84733678FD8DFEEAD4 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT While the current code works correctly, replace the unbounded sprintf() with the safer snprintf() in fsl_rio_setup() to follow secure coding best practices. Signed-off-by: Thorsten Blum --- arch/powerpc/sysdev/fsl_rio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c index eb55dabb4748..077c03cd93e4 100644 --- a/arch/powerpc/sysdev/fsl_rio.c +++ b/arch/powerpc/sysdev/fsl_rio.c @@ -612,7 +612,7 @@ static int fsl_rio_setup(struct platform_device *dev) kfree(port); continue; } - sprintf(port->name, "RIO mport %d", i); + snprintf(port->name, sizeof(port->name), "RIO mport %d", i); priv->dev = &dev->dev; port->dev.parent = &dev->dev;