From nobody Sat Feb 7 14:57:27 2026 Received: from out-183.mta1.migadu.com (out-183.mta1.migadu.com [95.215.58.183]) (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 336032D7DC1 for ; Mon, 5 Jan 2026 14:52:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.183 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767624749; cv=none; b=ecHBBLMeScOzHe9Ub+BaxhoKzqd2Sbmm/CDOXcMw0fQsCn5UbxNWJPPvJWsei6Dfs03r8c/Lv8EEFx0YlKubtyffHE6xso5xvaGY5W3AGkI2RG1tAhsYs391Zl10dcnUzBHyPrm+wpKRiKNpojBwdiQLNb4KiPwF8srojIO6lrU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767624749; c=relaxed/simple; bh=5nMIfEABV8JPk0/1GBhF6FLpko1dWB1z4qO3YVpNfT4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=fvcaZyGJPhu866uzYsHiQLTLrEE9e9YmTXXaMZKsqNf9pzOcGFLiy5Lef9D0el+0cOLks+uP0zGFPhRWYf5yiVj0sueq7celuuT7EgyArHkZ6B66Gq1qm5mLnyZXNFxxoKxlc1TTbUtVhHTcYmJBjdtPMOiy+NREUfU4+UJmDWE= 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=lj0HN+lm; arc=none smtp.client-ip=95.215.58.183 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="lj0HN+lm" 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=1767624730; 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=hr+N5djQhAopsvCEmnr4rlHkUGJjovOU/36k2aG4V2U=; b=lj0HN+lma+qGJRr88y0yRTX7xvpcJ1rUcjqWTnJSjTOOxs+f0wvYIgv9l69NRgF0VzCcbw V2SuEEAWRD2u8PnZ04f+fL5IcxTUUFLZM1Jv/+pM8QgcPGHOvlbDrkrZHnt9OVS4KGECtI gX6bGkeUhKLC18vtSt1r3SDuFMYrKlA= From: Thorsten Blum To: Chen Yu , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Maximilian Luz Cc: Thorsten Blum , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] platform/surface: Replace deprecated strcpy() in surface_button_add() Date: Mon, 5 Jan 2026 15:50:46 +0100 Message-ID: <20260105145045.52764-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. Replace it with the safer strscpy(). No functional changes. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy= [1] Reviewed-by: Chen Yu Signed-off-by: Thorsten Blum --- Changes in v2: - Remove local variable 'name' (Ilpo) - Update patch subject (Ilpo) - Link to v1: https://lore.kernel.org/lkml/20260105121802.1947-2-thorsten.b= lum@linux.dev/ --- drivers/platform/surface/surfacepro3_button.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/platform/surface/surfacepro3_button.c b/drivers/platfo= rm/surface/surfacepro3_button.c index 2755601f979c..e652c85c9161 100644 --- a/drivers/platform/surface/surfacepro3_button.c +++ b/drivers/platform/surface/surfacepro3_button.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -189,7 +190,6 @@ static int surface_button_add(struct acpi_device *devic= e) struct surface_button *button; struct input_dev *input; const char *hid =3D acpi_device_hid(device); - char *name; int error; =20 if (strncmp(acpi_device_bid(device), SURFACE_BUTTON_OBJ_NAME, @@ -210,11 +210,10 @@ static int surface_button_add(struct acpi_device *dev= ice) goto err_free_button; } =20 - name =3D acpi_device_name(device); - strcpy(name, SURFACE_BUTTON_DEVICE_NAME); + strscpy(acpi_device_name(device), SURFACE_BUTTON_DEVICE_NAME); snprintf(button->phys, sizeof(button->phys), "%s/buttons", hid); =20 - input->name =3D name; + input->name =3D acpi_device_name(device); input->phys =3D button->phys; input->id.bustype =3D BUS_HOST; input->dev.parent =3D &device->dev; @@ -228,8 +227,8 @@ static int surface_button_add(struct acpi_device *devic= e) goto err_free_input; =20 device_init_wakeup(&device->dev, true); - dev_info(&device->dev, - "%s [%s]\n", name, acpi_device_bid(device)); + dev_info(&device->dev, "%s [%s]\n", acpi_device_name(device), + acpi_device_bid(device)); return 0; =20 err_free_input: --=20 Thorsten Blum GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4