From nobody Thu Dec 18 16:14:27 2025 Received: from out-171.mta1.migadu.com (out-171.mta1.migadu.com [95.215.58.171]) (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 8B1BE1C6FFC for ; Wed, 19 Feb 2025 22:48:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740005296; cv=none; b=kBb2aWLbQprcKCFc4LtJ2owMq0TDpP+tql68tl4xiRrGUpTYoI9hAsrhyV3n8Ux/4F8jDwSuXCA9pPUJ7wXymhGAr6IEuXh/4vBb3oAtgRURdjalG6eIb8oO0SUGyo6a8OJL5+1B2Erjb770BWyC5HGXKGuhAl5HkwmcXCRn23s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740005296; c=relaxed/simple; bh=fCP3McsTMgJpNvyO66Y1RDO2PBxT8DfXrv1mDnhT144=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=tUC3uKap0APJQKd5ouPzk/NUuv9ZjGOUZT+o3hE+n9klLRNBQmIC9dlAp1rPJQD45x9jXniLM9U3YzIEqzbbd9Ie98l1gjGd7QkiS6iS3Wx9LO86+OPIQqafIHP737A4qdhOnpPqcdTMnDGomuB0oEfUpEudzvTNoeZjK2GNuHU= 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=V4ghLR0m; arc=none smtp.client-ip=95.215.58.171 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="V4ghLR0m" 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=1740005290; 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=FLdeIOJ0cVMGZIjfbYqeq+xUkR3G/JMvqLqXwcOF0l0=; b=V4ghLR0m45eDcc94yDrbhYON7qv99zvqE13vyqGrAiIomZ4mP3PlIEECjP1k4V7Kkt6YSR vppS57+aUj1hrXGxomSeMg7pT9LVl1UQ9/CNY3RHS/m3QHGwNZlEdcvegG4ty1hD3LZhPY bJnCb6ZGbv5BeNeLaofWA/L6uLVZrp8= From: Thorsten Blum To: Allison Henderson , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman Cc: Thorsten Blum , linux-hardening@vger.kernel.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, rds-devel@oss.oracle.com, linux-kernel@vger.kernel.org Subject: [PATCH net-next] net/rds: Replace deprecated strncpy() with strscpy_pad() Date: Wed, 19 Feb 2025 23:47:31 +0100 Message-ID: <20250219224730.73093-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" strncpy() is deprecated for NUL-terminated destination buffers. Use strscpy_pad() instead and remove the manual NUL-termination. Compile-tested only. Link: https://github.com/KSPP/linux/issues/90 Cc: linux-hardening@vger.kernel.org Signed-off-by: Thorsten Blum Reviewed-by: Allison Henderson Reviewed-by: Kees Cook Tested-by: Allison Henderson --- net/rds/stats.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/rds/stats.c b/net/rds/stats.c index 9e87da43c004..cb2e3d2cdf73 100644 --- a/net/rds/stats.c +++ b/net/rds/stats.c @@ -89,8 +89,7 @@ void rds_stats_info_copy(struct rds_info_iterator *iter, =20 for (i =3D 0; i < nr; i++) { BUG_ON(strlen(names[i]) >=3D sizeof(ctr.name)); - strncpy(ctr.name, names[i], sizeof(ctr.name) - 1); - ctr.name[sizeof(ctr.name) - 1] =3D '\0'; + strscpy_pad(ctr.name, names[i]); ctr.value =3D values[i]; =20 rds_info_copy(iter, &ctr, sizeof(ctr)); --=20 2.48.1