From nobody Thu Apr 9 08:54:42 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 5F9F744103A; Tue, 10 Mar 2026 09:44:56 +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=1773135899; cv=none; b=XfF7PNnNdxyTFzQWC0RdjiigU9YDQOP5+ejoz4FYvZcrOnWIyGH6MfHhZZVVK8LiouIldiJgNA625U49JsnJGn4SIOufIUXAp0QR8/bZ1I3iLArKh2S9wwfpvxrA/FKlxQM/MsrapyrFMt1Qj6d9iDXtp++VlOPvKhNFc977PLY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773135899; c=relaxed/simple; bh=9EfWUh4LIlliTHVHIHojuN/Nm6av4DpHyQ/mskLLTJo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ha9bJpPN3J7PH5jpmlfJ2OVeLE05NgL5C2y1B9PRkVRNj5IPniwBBnjbaGCeU06Qqeen+RSHRm5RImH3ZOXBxxf1mbUZSfZPVuG0EGtKfb2MKZrQ9DaR9e8FAnmBJAnK+JJv6+t8C0U86qsWv+tvUwV9WgNBpIpOEZ9FHQv9sR0= 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: c924ad2c1c6511f1a21c59e7364eecb8-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, 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:72c12f83-8533-48a7-9474-9ae05965725e,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:72c12f83-8533-48a7-9474-9ae05965725e,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:8af7086329d6fbeeaeb8b095fd0634c6,BulkI D:2603101744527D5PWH3T,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: c924ad2c1c6511f1a21c59e7364eecb8-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 817873943; Tue, 10 Mar 2026 17:44:51 +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 3/6] usb: gadget: functionfs: Use safer strscpy() instead of strcpy() Date: Tue, 10 Mar 2026 17:44:31 +0800 Message-Id: <20260310094434.3639602-4-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/gadget/function/f_midi2.c | 6 +++--- drivers/usb/gadget/function/u_serial.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/gadget/function/f_midi2.c b/drivers/usb/gadget/fun= ction/f_midi2.c index b5f0defde95d..19fdac024343 100644 --- a/drivers/usb/gadget/function/f_midi2.c +++ b/drivers/usb/gadget/function/f_midi2.c @@ -1541,9 +1541,9 @@ static int f_midi2_create_card(struct f_midi2 *midi2) return err; midi2->card =3D card; =20 - strcpy(card->driver, "f_midi2"); - strcpy(card->shortname, "MIDI 2.0 Gadget"); - strcpy(card->longname, "MIDI 2.0 Gadget"); + strscpy(card->driver, "f_midi2"); + strscpy(card->shortname, "MIDI 2.0 Gadget"); + strscpy(card->longname, "MIDI 2.0 Gadget"); =20 id =3D 0; for (i =3D 0; i < midi2->num_eps; i++) { diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/fu= nction/u_serial.c index e43ad6373846..cdd1dfc666c4 100644 --- a/drivers/usb/gadget/function/u_serial.c +++ b/drivers/usb/gadget/function/u_serial.c @@ -1086,7 +1086,7 @@ static int gs_console_init(struct gs_port *port) if (!cons) return -ENOMEM; =20 - strcpy(cons->console.name, "ttyGS"); + strscpy(cons->console.name, "ttyGS"); cons->console.write =3D gs_console_write; cons->console.device =3D gs_console_device; cons->console.flags =3D CON_PRINTBUFFER; --=20 2.34.1