From nobody Sat Oct 4 15:57:16 2025 Received: from out-188.mta1.migadu.com (out-188.mta1.migadu.com [95.215.58.188]) (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 1EE2063B9 for ; Thu, 14 Aug 2025 18:16:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755195374; cv=none; b=I9L0IhAgl9Qccn7R0g6D2HaruAFM/Rn39MztKqpjp4f79AnuCkVq5eAc3pn3uubOCwxgOx78AYjOJCQBZHrfwWUwS7COGu6S7C09bJ+p/zVv663ojW5liQ4ZWBvNp8y+3maLzTfLxjUxIbVNYK6cEfViUX0I7lrOn4c9qmMPpRY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755195374; c=relaxed/simple; bh=d2Ulm/XIjGVlbLGsYARxfo4PVZkxzdBk4wMZupOCeLs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=qO22No1HMXm7h8v9UiZm/OG3cIAcuzSbD0xe09YOv802oKZI+7rSfpiK23Fe9pvVhxmrv5hraoyydWYSGoinbfHDT9VITwTsiKOKLcQYqGt/Z7Wa1raX0GbIX/jlF2WiI5lkoGSZaoSmW15+LnPlYCJjoPo124EKGORiNd5WEfY= 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=rSvnquOy; arc=none smtp.client-ip=95.215.58.188 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="rSvnquOy" 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=1755195360; 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=gBXi1Jms/31Rd25COKA1CAhr6nVAQI7I8OoejczvZE8=; b=rSvnquOyMSeHgEKHNzEYWTfxgYcT51QQM3kzCYSgwsxajFdThWV4oee6hlq96w+H0MvkGn vCXKweFJKqYiRdWUHK1UunoU72lbtYv+u5sRHbGQJfO8bCyl6fC2NQ1ScYj69vLr55bmsn hdQYD+r0zo5m7OsZa7FcrKSwGIJEzN4= From: Thorsten Blum To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Thorsten Blum , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next] net: Space: Replace memset(0) + strscpy() with strscpy_pad() Date: Thu, 14 Aug 2025 20:05:14 +0200 Message-ID: <20250814180514.251000-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 memset(0) followed by strscpy() with strscpy_pad() to improve netdev_boot_setup_add(). This avoids zeroing the memory before copying the string and ensures the destination buffer is only written to once, simplifying the code and improving efficiency. Signed-off-by: Thorsten Blum --- drivers/net/Space.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/Space.c b/drivers/net/Space.c index dc50797a2ed0..c01e2c2f7d6c 100644 --- a/drivers/net/Space.c +++ b/drivers/net/Space.c @@ -67,8 +67,7 @@ static int netdev_boot_setup_add(char *name, struct ifmap= *map) s =3D dev_boot_setup; for (i =3D 0; i < NETDEV_BOOT_SETUP_MAX; i++) { if (s[i].name[0] =3D=3D '\0' || s[i].name[0] =3D=3D ' ') { - memset(s[i].name, 0, sizeof(s[i].name)); - strscpy(s[i].name, name, IFNAMSIZ); + strscpy_pad(s[i].name, name); memcpy(&s[i].map, map, sizeof(s[i].map)); break; } --=20 2.50.1