From nobody Thu Apr 9 08:55:25 2026 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (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 ACC77449EBF; Tue, 10 Mar 2026 09:45:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773135902; cv=none; b=YqsyHYrZirIhykczcMWSsKE1FMIKygwR25/COE8EqWxMFN73QCDMjCrSgWIBQgHMz7OrL3vumJWULZRkQqenzGTi7QyWQNDj54LhvDDRONwQKGqRybCrtj28BO6kR5WIlukWsXrjpovUrZg/dijnYdwzv3UC4c7te6/JseCpGpY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773135902; c=relaxed/simple; bh=GrKI0fhdjTNALKtnUn3BXbkJ3Q/9AVXQwKXQD/3VoqQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=T5q8MoFvjhCrCNzjGnN64doXX1w0vripWf0xoYOAQmDjFasyLjQu9tOVopKZHASJsn56NOYXgWOx0zUV749yWull6Ksr2K/gYxnUUozkfxMxiRO8WJDTIWs2LQyONeCfs9IFRd8BwsUZcVKQNzWX0ktoS+UmrX589fmpFA+VWKk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: ca0a154c1c6511f1a21c59e7364eecb8-20260310 X-CTIC-Tags: HR_CC_COUNT, HR_CC_DOMAIN_COUNT, HR_CC_NAME, HR_CC_NO_NAME, HR_CTE_8B HR_CTT_MISS, HR_DATE_H, HR_DATE_WKD, HR_DATE_ZONE, HR_FROM_NAME HR_SJ_DIGIT_LEN, HR_SJ_LANG, HR_SJ_LEN, HR_SJ_LETTER, HR_SJ_NOR_SYM HR_SJ_PHRASE, HR_SJ_PHRASE_LEN, HR_SJ_WS, HR_TO_COUNT, HR_TO_DOMAIN_COUNT HR_TO_NO_NAME, IP_TRUSTED, SRC_TRUSTED, DN_TRUSTED, SA_EXISTED SN_EXISTED, SPF_NOPASS, DKIM_NOPASS, DMARC_NOPASS, OB_FP CIE_GOOD, CIE_GOOD_SPF, GTI_FG_BS, GTI_RG_INFO, GTI_C_BU AMN_GOOD, ABX_MISS_RDNS X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.11,REQID:e7f6c9ff-c19f-4527-b109-8e5d1c547a5c,IP:10, URL:0,TC:0,Content:0,EDM:0,RT:0,SF:-30,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:-20 X-CID-INFO: VERSION:1.3.11,REQID:e7f6c9ff-c19f-4527-b109-8e5d1c547a5c,IP:10,UR L:0,TC:0,Content:0,EDM:0,RT:0,SF:-30,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-20 X-CID-META: VersionHash:89c9d04,CLOUDID:f8780bb118ed3b06b8df804b7c91fad3,BulkI D:260310174455UP489A2B,BulkQuantity:0,Recheck:0,SF:10|38|66|78|81|82|102|1 27|898,TC:nil,Content:0|15|50,EDM:-3,IP:-2,URL:0,File:nil,RT:nil,Bulk:nil, QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 ,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: ca0a154c1c6511f1a21c59e7364eecb8-20260310 X-User: aichao@kylinos.cn Received: from huangwei.. [(112.64.161.44)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 561612145; Tue, 10 Mar 2026 17:44:53 +0800 From: Ai Chao To: gregkh@linuxfoundation.org, b-liu@ti.com, johan@kernel.org, badhri@google.com, heikki.krogerus@linux.intel.com, valentina.manea.m@gmail.com, shuah@kernel.org, i@zenithal.me, tiwai@suse.de, kees@kernel.org, christophe.jaillet@wanadoo.fr, prashanth.k@oss.qualcomm.com, khtsai@google.com, dan.carpenter@linaro.org, tglx@kernel.org, mingo@kernel.org Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Ai Chao Subject: [PATCH 4/6] usb: typec: tcpm: Use safer strscpy() instead of strcpy() Date: Tue, 10 Mar 2026 17:44:32 +0800 Message-Id: <20260310094434.3639602-5-aichao@kylinos.cn> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260310094434.3639602-1-aichao@kylinos.cn> References: <20260310094434.3639602-1-aichao@kylinos.cn> 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 Content-Type: text/plain; charset="utf-8" Use a safer function strscpy() instead of strcpy() for copying to arrays. Only idiomatic code replacement, and no functional changes. Signed-off-by: Ai Chao --- drivers/usb/typec/tcpm/tcpm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index 1d2f3af034c5..8d939ffb9ac7 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -725,7 +725,7 @@ static void _tcpm_log(struct tcpm_port *port, const cha= r *fmt, va_list args) =20 if (tcpm_log_full(port)) { port->logbuffer_head =3D max(port->logbuffer_head - 1, 0); - strcpy(tmpbuffer, "overflow"); + strscpy(tmpbuffer, "overflow"); } =20 if (port->logbuffer_head < 0 || @@ -841,10 +841,10 @@ static void tcpm_log_source_caps(struct tcpm_port *po= rt) pdo_spr_avs_apdo_15v_to_20v_max_current_ma(pdo), pdo_spr_avs_apdo_src_peak_current(pdo)); else - strcpy(msg, "undefined APDO"); + strscpy(msg, "undefined APDO"); break; default: - strcpy(msg, "undefined"); + strscpy(msg, "undefined"); break; } tcpm_log(port, " PDO %d: type %d, %s", --=20 2.34.1