From nobody Mon Oct 6 15:24:14 2025 Received: from out-187.mta1.migadu.com (out-187.mta1.migadu.com [95.215.58.187]) (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 732AF21170D for ; Fri, 18 Jul 2025 20:38:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752871108; cv=none; b=Yh0+3iDm37fD/SFRKWqyjy2E1z1L7B6stB92xjdXuiHSOpA7tgspiab4lYNVXS7s0uwdETjCWssmvmOx6FnANYMEi9CGsm7DwPe17ZeQbFxFX4rUAF7dbhqxHQEijBLA17ueVg0WkCoEzrHahTg9YiZeIgdOOGA9cJGXD7BQn0Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752871108; c=relaxed/simple; bh=AlSsbH4kX1OcQbvP9Y1wqo3dCVOQoo2TxQ9akrFfIXE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=MxbNlfqjd0+TWq7TSeWwdcoPCL80U5WBPwtWVL88Aaul3GnGSYaGwDAUfvYJybAcBg/A4jvcqw7wxm+MW9MnwdL/OymqGS7hmFcsT4pJXq9t2OcmC2x1pTReF24SZP+GfAWSwSYfDdu74uMeAXa43nC3jSkq8irBb//QDsu2toc= 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=cHfjIPne; arc=none smtp.client-ip=95.215.58.187 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="cHfjIPne" 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=1752871093; 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=50pMAbyQnwdgTZJ9btJV+F/njGuW6C2RnKWeUz9kqlA=; b=cHfjIPnelcGPMwyHpn7fAW+3yO9rm+BYezUNfIMp9/0tTfvK2IBBVgHNm66GWYrUu15jdp AplKmxmUNpeUu2T6/INAbaqsKG3GXK+yo0wLIwZdrDkqms7qU8L3z5urv+rnMZtCsbnXw0 XPiT96dfTJvaC1xi6TeaUIfGYpuDhdE= From: Thorsten Blum To: Paul Moore , Eric Paris Cc: linux-hardening@vger.kernel.org, Thorsten Blum , audit@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] audit: Replace deprecated strcpy() with strscpy() Date: Fri, 18 Jul 2025 22:37:34 +0200 Message-ID: <20250718203734.347091-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" strcpy() is deprecated; use strscpy() instead. Link: https://github.com/KSPP/linux/issues/88 Signed-off-by: Thorsten Blum --- kernel/audit_tree.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c index b0eae2a3c895..1605df0a171e 100644 --- a/kernel/audit_tree.c +++ b/kernel/audit_tree.c @@ -93,8 +93,10 @@ static struct kmem_cache *audit_tree_mark_cachep __ro_af= ter_init; static struct audit_tree *alloc_tree(const char *s) { struct audit_tree *tree; + size_t sz; =20 - tree =3D kmalloc(struct_size(tree, pathname, strlen(s) + 1), GFP_KERNEL); + sz =3D strlen(s) + 1; + tree =3D kmalloc(struct_size(tree, pathname, sz), GFP_KERNEL); if (tree) { refcount_set(&tree->count, 1); tree->goner =3D 0; @@ -103,7 +105,7 @@ static struct audit_tree *alloc_tree(const char *s) INIT_LIST_HEAD(&tree->list); INIT_LIST_HEAD(&tree->same_root); tree->root =3D NULL; - strcpy(tree->pathname, s); + strscpy(tree->pathname, s, sz); } return tree; } --=20 2.50.1