From nobody Tue Dec 16 21:30:16 2025 Received: from unicom146.biz-email.net (unicom146.biz-email.net [210.51.26.146]) (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 ECC2B28368A; Fri, 5 Sep 2025 09:19:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.51.26.146 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757063948; cv=none; b=qVnvriQg3+fHnGSQHVYga8x5OjDV8rOHk2nShNzB9FnisslkTFJaJDnqdwEHuBN+v36mQgLAu/+YVp2v+8xaYeoCW7DL9VZPkFgC8IxV9sjpZo7fj5i+ORGRByho6ze0HtpwekNR0I4K1pl6i7xcsI+zaU126fwLw3maDRRupYY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757063948; c=relaxed/simple; bh=QJh7UYdMg5+jnupJYbkvvs22KA7iLIX9cXWjiUUeBlg=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=MKkrlJ8b+IkVLg3nwm64rabZewY3h1d0n+GJfrJNMgItPLXAaJrRTuUEYp+c0QGTib/WyKXJBj9DpepJLDsINzlEGy24Gl6DTIKO3buLbY0S6lw7s7lg/bvwiCIpKfo66LrE0GeInZpG5IQVsVnIylk46+5kYuyI9238KkJ1xDw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=inspur.com; spf=pass smtp.mailfrom=inspur.com; arc=none smtp.client-ip=210.51.26.146 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=inspur.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=inspur.com Received: from jtjnmail201602.home.langchao.com by unicom146.biz-email.net ((D)) with ASMTP (SSL) id 202509051718479538; Fri, 05 Sep 2025 17:18:47 +0800 Received: from jtjnmail201607.home.langchao.com (10.100.2.7) by jtjnmail201602.home.langchao.com (10.100.2.2) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.57; Fri, 5 Sep 2025 17:18:48 +0800 Received: from locahost.localdomain.com (10.94.16.219) by jtjnmail201607.home.langchao.com (10.100.2.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.57; Fri, 5 Sep 2025 17:18:48 +0800 From: Charles Han To: , , , , CC: , , Charles Han Subject: [PATCH] ASoC: codecs: fs210x: Add NULL check in fs210x_register_snd_component Date: Fri, 5 Sep 2025 17:18:44 +0800 Message-ID: <20250905091845.1559-1-hanchunchao@inspur.com> X-Mailer: git-send-email 2.43.0 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-ClientProxiedBy: Jtjnmail201614.home.langchao.com (10.100.2.14) To jtjnmail201607.home.langchao.com (10.100.2.7) tUid: 202590517184807ad9422a74d1806161ce1cdb36657b0 X-Abuse-Reports-To: service@corp-email.com Abuse-Reports-To: service@corp-email.com X-Complaints-To: service@corp-email.com X-Report-Abuse-To: service@corp-email.com Content-Type: text/plain; charset="utf-8" Add check for the return value of devm_kmemdup() to prevent potential null pointer dereference. Fixes: 756117701779 ("ASoC: codecs: Add FourSemi FS2104/5S audio amplifier = driver") Signed-off-by: Charles Han --- sound/soc/codecs/fs210x.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/soc/codecs/fs210x.c b/sound/soc/codecs/fs210x.c index b4f51ee7235a..e2f85714972d 100644 --- a/sound/soc/codecs/fs210x.c +++ b/sound/soc/codecs/fs210x.c @@ -1458,6 +1458,9 @@ static int fs210x_register_snd_component(struct fs210= x_priv *fs210x) dai_drv->name =3D devm_kasprintf(fs210x->dev, GFP_KERNEL, "%s-%d", dai_drv->name, instance_id); + if (!dai_drv->name) + return -ENOMEM; + instance_id++; =20 if (fs210x->devid =3D=3D FS2105S_DEVICE_ID) { --=20 2.43.0