From nobody Thu Nov 28 20:05:40 2024 Received: from ssh248.corpemail.net (ssh248.corpemail.net [210.51.61.248]) (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 67CE017C8B for ; Sun, 29 Sep 2024 03:42:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.51.61.248 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727581359; cv=none; b=FVcAzLb6lFu7lceJSyE0BJ6rVFZxELVjd3cyEC/eou/Ik2R66uZuo8O06MgHrFIGiEguQJkK+5YetbEr1RQ0MhEa8kDAP3jjTh6jJ2YOTdnTFHFwBPFkOsyi+f9KVzgZ/SJ26h+YsI5F/q+/eiXwzowPJh1Zmb6GxqGYxDRvdTo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727581359; c=relaxed/simple; bh=pE+BzXbZxh9x3ZkVaXFexhxwNufUAvFQkw5XyCzxzRE=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=NIHGTOVDYtHC29SWADBQ75Ok0euK/SNNGu97/sUb6U7vKg8BaMwnAMVi/TG0TaJEv737QGTNcMOLi3UeGxhrJLjEMaA66NlCPRtMbKqjMbEy3/l1xdHdodUMabPeXjzarFn7jLSjFrg75O615DWHBiRuIi8/5gCABUaCqBicgAw= 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.61.248 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 ssh248.corpemail.net by ssh248.corpemail.net ((D)) with ASMTP (SSL) id ZCT00121; Sun, 29 Sep 2024 11:42:21 +0800 Received: from jtjnmail201607.home.langchao.com (10.100.2.7) by Jtjnmail201616.home.langchao.com (10.100.2.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Sun, 29 Sep 2024 11:42:25 +0800 Received: from localhost.localdomain (10.94.12.73) 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.39; Sun, 29 Sep 2024 11:42:25 +0800 From: Charles Han To: , CC: , Charles Han Subject: [PATCH] uio: uio_fsl_elbc_gpcm: Add check devm_kasprintf() returned value Date: Sun, 29 Sep 2024 11:42:23 +0800 Message-ID: <20240929034223.59209-1-hanchunchao@inspur.com> X-Mailer: git-send-email 2.31.1 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: Jtjnmail201615.home.langchao.com (10.100.2.15) To jtjnmail201607.home.langchao.com (10.100.2.7) tUid: 2024929114221142bf2079b071793e49279942207ef58 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" devm_kasprintf() can return a NULL pointer on failure but this returned value in uio_fsl_elbc_gpcm_probe() is not checked. Fixes: d57801c45f53 ("uio: uio_fsl_elbc_gpcm: use device-managed allocators= ") Signed-off-by: Charles Han --- drivers/uio/uio_fsl_elbc_gpcm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/uio/uio_fsl_elbc_gpcm.c b/drivers/uio/uio_fsl_elbc_gpc= m.c index 496caff66e7e..6378e752f828 100644 --- a/drivers/uio/uio_fsl_elbc_gpcm.c +++ b/drivers/uio/uio_fsl_elbc_gpcm.c @@ -384,6 +384,9 @@ static int uio_fsl_elbc_gpcm_probe(struct platform_devi= ce *pdev) =20 /* set all UIO data */ info->mem[0].name =3D devm_kasprintf(&pdev->dev, GFP_KERNEL, "%pOFn", nod= e); + if (!info->mem[0].name) + return -ENOMEM; + info->mem[0].addr =3D res.start; info->mem[0].size =3D resource_size(&res); info->mem[0].memtype =3D UIO_MEM_PHYS; --=20 2.31.1