From nobody Tue Dec 2 02:42:39 2025 Received: from out-173.mta1.migadu.com (out-173.mta1.migadu.com [95.215.58.173]) (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 364183376B8 for ; Tue, 18 Nov 2025 13:57:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763474241; cv=none; b=GM5/03maChyrB4wem7iKIWrVayj63c2wTFnueiYMKjY9b5VzTj7MeP8r/6KfS5iCNY931Gqt6gBbJ4LlIwBfeqjZazGOguuO/Jfyw4pEnHTQtG5c5uzVrkjBUDthmqVnWrl6j5NG6+btr0mq2IVObamW2RMRYPj6IDJmINbT5eE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763474241; c=relaxed/simple; bh=B7Y2jPvXl+Ml5QhQY6ztxFtDJUDkgSlRRQBd47ldFNo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=A10c0D2dQqx0u8d2PQujRXMuFeAyGVeY8zG1KsEBede5amiqSM7KOH40N1zCjY4GHkYxfGNSNr+afhTXOKxZLS1Glv+0aDgRWS+f4OycKHfQyr/zeMzYGEwvd1keQyC0paWwRHwCdoYbzdiqjbPG5xDPPG3bXo/nCsOFNSxcE+E= 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=JxauxAMP; arc=none smtp.client-ip=95.215.58.173 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="JxauxAMP" 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=1763474233; 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=hmbMMb0x7lTr3iL7dutg+8V0gOGJqiVZ6GailA3Ebok=; b=JxauxAMPa914qmTvX/ido2fDW11/RgBnkldyHSIgitunKlCCfXdjhror68o+R0a3LKXzFy qBEYoNjSW2pZE6CmT6+9PALMrdt1BliUelGr6w2FLF76g6AV8FJ4EcaywFqzwJqcAsfDwa aR7+WU8n/EDMSSi6YYrNvp7xRMbvSDA= From: Thorsten Blum To: Mauro Carvalho Chehab , Borislav Petkov , Tony Luck Cc: Thorsten Blum , linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] EDAC/ghes: Replace deprecated strcpy in ghes_edac_report_mem_error Date: Tue, 18 Nov 2025 14:56:22 +0100 Message-ID: <20251118135621.101148-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() has been deprecated [1] because it performs no bounds checking on the destination buffer, which can lead to buffer overflows. Use the safer strscpy() instead. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy= [1] Signed-off-by: Thorsten Blum --- Changes in v2: - Update patch description (Boris) - Link to v1: https://lore.kernel.org/lkml/20251031114607.133523-1-thorsten= .blum@linux.dev/ --- drivers/edac/ghes_edac.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c index 1eb0136c6fbd..d80c88818691 100644 --- a/drivers/edac/ghes_edac.c +++ b/drivers/edac/ghes_edac.c @@ -15,6 +15,7 @@ #include "edac_module.h" #include #include +#include =20 #define OTHER_DETAIL_LEN 400 =20 @@ -332,7 +333,7 @@ static int ghes_edac_report_mem_error(struct notifier_b= lock *nb, p =3D pvt->msg; p +=3D snprintf(p, sizeof(pvt->msg), "%s", cper_mem_err_type_str(etype)); } else { - strcpy(pvt->msg, "unknown error"); + strscpy(pvt->msg, "unknown error"); } =20 /* Error address */ @@ -357,14 +358,14 @@ static int ghes_edac_report_mem_error(struct notifier= _block *nb, dimm =3D find_dimm_by_handle(mci, mem_err->mem_dev_handle); if (dimm) { e->top_layer =3D dimm->idx; - strcpy(e->label, dimm->label); + strscpy(e->label, dimm->label); } } if (p > e->location) *(p - 1) =3D '\0'; =20 if (!*e->label) - strcpy(e->label, "unknown memory"); + strscpy(e->label, "unknown memory"); =20 /* All other fields are mapped on e->other_detail */ p =3D pvt->other_detail; --=20 2.51.1