From patchwork Fri Jun 13 16:35:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Mokashi X-Patchwork-Id: 897394 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3966EC71135 for ; Mon, 16 Jun 2025 06:35:34 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [45.14.194.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 53C1860182; Mon, 16 Jun 2025 08:35:22 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 53C1860182 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1750055732; bh=g1XSuWIHwWc44focdtp8wOAM0TQEgX6inz/PxMgrpj4=; h=From:To:Cc:Subject:Date:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=YCcl2FuKLGj30l5JPjM5rG+5XFEDMOcntsYM1J2sD59gqfYUdTwtKmo95xj88SPzZ 7wNvLMdPZZux2wuhkSPb/lXjqa1SQ8YYGzFYXUargpJELBHmTDN03L9TNNC3y8fG0N 0uhpeLNYvEpWq7aN5drHChl1+ALwf5c+Cs5Cucik= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 69A26F805BA; Mon, 16 Jun 2025 08:34:56 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 4C69AF805B6; Mon, 16 Jun 2025 08:34:56 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id BCC66F80424; Fri, 13 Jun 2025 18:36:32 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 16DF1F80075 for ; Fri, 13 Jun 2025 18:36:29 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 16DF1F80075 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=MZccYSNx DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1749832591; x=1781368591; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=g1XSuWIHwWc44focdtp8wOAM0TQEgX6inz/PxMgrpj4=; b=MZccYSNxT7lp+R16aNGNZv+TDgM1DR0aLnt3HV7lJ1cCBAN81/lS9+e3 EEj6L2cTNqCpOiNn4wamPAwBz+4WLEabvH91ZJqzHhgutRZ8KmW7SELNb XFv3NrUPiAalOt446NS1z36jSzGNuMKonBryQXa11sgimmRa2PDiJR17S Xr9c8VOHj5eRxQx3SQ1reFBBrV+9U+j/I6A/zEobuW26R4+roI/Qzm+8L 7CtaDhpemr3owywF3Bhn28p6o5IG8bGoPv1g6neotxv4TOucSxZqSoszl fmYy6Qu2LF//AssJSN7kX+7MuTTDFzPX5+x4ZAkWZnefcVEEkcGo6UCaP w==; X-CSE-ConnectionGUID: 7WpPq4AhQYyhPJH6E2dv/A== X-CSE-MsgGUID: 9P5VPSDzRlOUlbtd9dR8rA== X-IronPort-AV: E=McAfee;i="6800,10657,11463"; a="55728381" X-IronPort-AV: E=Sophos;i="6.16,234,1744095600"; d="scan'208";a="55728381" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jun 2025 09:36:25 -0700 X-CSE-ConnectionGUID: /rVRdw37SKCgwB810QmCEQ== X-CSE-MsgGUID: TpM71zcwTNqEXIKQD6lKdA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.16,234,1744095600"; d="scan'208";a="148769965" Received: from jpp-desktop.igk.intel.com ([10.91.221.24]) by fmviesa009.fm.intel.com with ESMTP; 13 Jun 2025 09:36:24 -0700 From: Sachin Mokashi To: broonie@kernel.org Cc: linux-sound@vger.kernel.org, alsa-devel@alsa-project.org, tiwai@suse.com, pierre-louis.bossart@linux.dev, Sachin Mokashi Subject: [PATCH] ASoC: Intel: Replace deprecated strcpy() with strscpy() Date: Fri, 13 Jun 2025 12:35:30 -0400 Message-Id: <20250613163530.1165690-1-sachin.mokashi@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-MailFrom: sachin.mokashi@intel.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: HICS3RAWTALNOGPXPINCXSIT6GPCZM3O X-Message-ID-Hash: HICS3RAWTALNOGPXPINCXSIT6GPCZM3O X-Mailman-Approved-At: Mon, 16 Jun 2025 06:34:53 +0000 X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: strcpy() is deprecated, use strscpy() instead. As strcpy() performs no bounds checking on the destination buffer. This could result in buffer overflow. The safe replacement is strscpy(). Link: https://github.com/KSPP/linux/issues/88 Signed-off-by: Sachin Mokashi --- sound/soc/intel/boards/cht_bsw_rt5672.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/intel/boards/cht_bsw_rt5672.c b/sound/soc/intel/boards/cht_bsw_rt5672.c index aaef212cf44e..54c1894ee96a 100644 --- a/sound/soc/intel/boards/cht_bsw_rt5672.c +++ b/sound/soc/intel/boards/cht_bsw_rt5672.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -458,7 +459,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev) if (!drv) return -ENOMEM; - strcpy(drv->codec_name, RT5672_I2C_DEFAULT); + strscpy(drv->codec_name, RT5672_I2C_DEFAULT, sizeof(drv->codec_name)); /* find index of codec dai */ for (i = 0; i < ARRAY_SIZE(cht_dailink); i++) {