Received: by 2002:a05:7412:8d1c:b0:fa:4c10:6cad with SMTP id bj28csp478692rdb; Wed, 17 Jan 2024 07:47:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IHXAxklejHBpL09eo+HyWzlXACozTuWXxz6a9rxC1j9cTUWgXy0xlD4FRwqdnAtLwhhRPg+ X-Received: by 2002:a05:6a21:a597:b0:199:144b:e205 with SMTP id gd23-20020a056a21a59700b00199144be205mr10253480pzc.99.1705506454266; Wed, 17 Jan 2024 07:47:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705506454; cv=pass; d=google.com; s=arc-20160816; b=lyEXxVOzl4vJmhqoX5op17wLlFg59lBCCYXRBk8oj/4ZReUVwgzAfUKZxaHZ2fwI/1 v6jOnbf0SUqz56U4FcyLaVP4pI0r/OmROYV73lcPmteE/6NOjW2VIUXxZtugHsIg9YQr om6fGsOvThpWiQOIJqe4bqd1KNxc3fjc1vzwrSXhRdqg6nqjoqqv9sgqI43+ZPglWd/G 8uYHxIsdLj4stY09N/cZjjYyBa1lv9IFTja4lQN0gJPl374nNrxJas3+lXkIbno0SuuF ywjjh0oEVtIq/bI3tC42G6kWD954p1a2VT0kX37rQMewK8YLucz9SZJett8kBQuWg6k4 V5Gw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:subject:from:cc :content-language:to:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=2UFrKrFQgojm04QEbxOKUyqxkVsOutn2BFI9jkjWSmQ=; fh=XcPGBQRx1rl+qfrOQN39b0Q1u+6l8tl5xkn179zClwo=; b=DjuVuhhQqZPqStp1TfZf7QM8xEcWiFnveOPCW6LcdboGREAPilbTyRcuU3RFWB/JwN uNYssGMJn3XiBqRuYUfYqfk/ITZvOCPtOEVcEzf5XQCTEIT/t27sO8Gzu1LcS9siEqtd 12FFyJnz8X5okL8BiM+UbLR0Y20dZBl74Hd6aeerKFMO9SbqtZFRHQo5JpGyCW+gsi1/ hVTh9jRTFIvarpTHdBN2oCZj/qTEZWU3z8HjM7CplJ8B9a0URAfstBwI7Pr4CMs/xeJ+ BCkzuqx8fcGrIoV7MwUjE1MKxW6ovrD9ciULxKTTkBCCK7jlnnjrPddmJjPLx6BguKcg iUfw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@web.de header.s=s29768273 header.b=Kn4viGP6; arc=pass (i=1 spf=pass spfdomain=web.de dkim=pass dkdomain=web.de dmarc=pass fromdomain=web.de); spf=pass (google.com: domain of linux-kernel+bounces-29171-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29171-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=web.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id w8-20020a17090a780800b0028c06f5b62bsi16555055pjk.137.2024.01.17.07.47.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 07:47:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29171-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@web.de header.s=s29768273 header.b=Kn4viGP6; arc=pass (i=1 spf=pass spfdomain=web.de dkim=pass dkdomain=web.de dmarc=pass fromdomain=web.de); spf=pass (google.com: domain of linux-kernel+bounces-29171-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29171-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=web.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id C74CDB23AFC for ; Wed, 17 Jan 2024 15:47:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E9FC021A1A; Wed, 17 Jan 2024 15:47:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b="Kn4viGP6" Received: from mout.web.de (mout.web.de [212.227.17.12]) (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 BB04521A04; Wed, 17 Jan 2024 15:47:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.17.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705506434; cv=none; b=Hh5ggD4gPT0oDQglxdKKPKVox+xE6PL8m96+9W4Bao1vF9uHkSDu/IqykMTtWZv5teofhJWcWSr+/vFBfoBnylZk8JJEkWoQWz0d5FSmpWKz4SD1fnJdRpYmvy+U79gyqvv55h3BnyQ0lJyLXwWxoeNWPS9YeW3MYPH0uyC0aF0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705506434; c=relaxed/simple; bh=imkRlcEIxSECpvWrb/WZ1Fs6wTq5TbwnfYWP3f3j4fs=; h=DKIM-Signature:X-UI-Sender-Class:Received:Message-ID:Date: MIME-Version:User-Agent:To:Content-Language:Cc:From:Subject: Content-Type:Content-Transfer-Encoding:X-Provags-ID:X-Spam-Flag: UI-OutboundReport; b=i8U9CK6evj8Mb112wgAdSnnu5X/1FtfHFlt1aSMBkQcutkiGmofuysPuIfMR5kh1Cab7jFtRXzFSqvGKwJDDv0P555/F4Yb+lppaJH51HT56xkAHzkFkQ1jlhykwpxc21BzwSCZR9nSyjbxgAXvCmpAu71+d275iDsaiI7/zKAg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de; spf=pass smtp.mailfrom=web.de; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b=Kn4viGP6; arc=none smtp.client-ip=212.227.17.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=web.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1705506412; x=1706111212; i=markus.elfring@web.de; bh=imkRlcEIxSECpvWrb/WZ1Fs6wTq5TbwnfYWP3f3j4fs=; h=X-UI-Sender-Class:Date:To:Cc:From:Subject; b=Kn4viGP66uEY6hxKFeNR65Oofu8m8OWNSkAVv97ZrRaL3xBmOukZq/3bam2QshtB 1nrBQ3OexdBFfGQ6j3M5K4GmxcrE8VOjPgh7eSjWJNLgDBjQ7PGnRZfBWdH0UntT5 o2ee8PvtfTjQMVg0goDHGDtlZfsKsUyEtLwECsiu+Z2PxwAu3e2MGQ9vhD5itao2R G0DoagToRPpXkEDCrQ5NgjmMnYnBvgEg5two8BQ2YElshGPux7N4t4UsBF4MIB+FM LyiG6HaxdZWxzOg0NcBwbO8npi0aCEO9MAikPL1yVUYaZruveWE0ilNCLV+NO8l5w 6RD1dvU480Ce92AldA== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.84.95]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1M1aDp-1rRVpv1iQN-003E2Y; Wed, 17 Jan 2024 16:46:52 +0100 Message-ID: <75f302b2-9fe0-4b3d-a132-85186c4d9445@web.de> Date: Wed, 17 Jan 2024 16:46:38 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: linux-clk@vger.kernel.org, kernel-janitors@vger.kernel.org, Alex Helms , Michael Turquette , Stephen Boyd Content-Language: en-GB Cc: LKML , Saeed Nowshadi , Kunwu Chan From: Markus Elfring Subject: [PATCH] clk: versaclock7: Return directly after a failed kasprintf() call in vc7_probe() Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:NgCtdZimQ5H+nTibuBuhAhJQP71uJFO/lCYKigwy9yWfdEzQ2Ep 1fS3Km4lhjngeIh1jGfZzmD7eygbbm+/eEn83smX2ZnuhHRfUp52GYqiyt6L23plZVUFIyG 2ICbgu10T5UeGP0dUFjh2hqVETLRNOLNKuMz1OJQ1qJOmmEEQFBdUz6fk8jtQaBDjhQv/4z fupMtFMdwomMLhhTNlcTA== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:+6buGsTWYV8=;2Fb2dSZsw8JVKKweUIItlQHbilk Wk0CGsJEH7Z2IcEqcPAq/BziG61Hr0kzofIqcQ4t7L//BagEXHq/qfmcmEM8wC/cwklC1O1EX EmbX0VnEV9yaRkTLv4sgoIyp7xc1SUVg1BkqX1BmkyqGVG/2Qbd9KYtT5J0GLU+1UQe86+Apq FobItahZnvZM8DwdeeWZB3fXfY2MTrVUAodpz0A6SOacvn7jRLx3w185+yhHLqmcdSTN06k37 2lLALBFw3eL4gOu3/ozkjgv0m9732FI/QjoRG3w1gxqb9ngCrKqmW86dc6A8FPBFfcvKV5XXv LMF+eGv5Vfn4e02SRGTXLkVrkPXXERlJMLp/yRUjixdl1jCPR5h2wcxEtk7JVBLG+Y2kPwUyJ aHYyP5jNbavgKPXzBl81T8UGa0k52bJNFzb54RYEe/8dDS9cB85fGjinjxZCfMq9g22HgjdHN rwDiby9mpW1ppymx//U8ddACOLMW7imp7sgsGfOShY/wy4L0p2A0NnO2h0vcCJYxn6nEcgwxf KmZr3WzbY81m98hwiFdUcQjU+baiIf+HRQNlw92qGlEVdMUXf3a1MiT11bR3ENwQ6nxbdMBU/ YW3C97YbFGP48PpM0vgSRmS2UoBaj2mCrSmy1ZObNh6wsd5p8jhJzn0v3MAj82S7YOuroeNd4 SXhaJ3ny/OECH9On3sL9LHyGIeVmBvSxHW7SYq4jYn5S19eFGGUb8nhNyJLUwAy/vZAL9hg0X zq/PjSL2b7ndsKFFHeIJnCDaw7keTVPquSnzrCBCO7kC7Hf9BuT3gDVWTc0TEzM9tyAn55qsO Z94sEOJMjsFRwSng7ek60b/tueZKiHjzz+fj7AuS1X1nS9FEm22gqtO0WqSG7m5UHoLdGYJN5 h8kFUaEQD0H8SJmDhqub59248Qxm6gYC5xa6YBZHFWfi7oo2yLZoWd1KFyCVYhrlzoDAR95jo 481BJg== From: Markus Elfring Date: Wed, 17 Jan 2024 14:06:13 +0100 The result from a call of the function =E2=80=9Ckasprintf=E2=80=9D was pas= sed to a subsequent function call without checking for a null pointer before (according to a memory allocation failure). This issue was detected by using the Coccinelle software. Thus return directly after a failed kasprintf() call. Fixes: 48c5e98fedd9e ("clk: Renesas versaclock7 ccf device driver") Signed-off-by: Markus Elfring =2D-- drivers/clk/clk-versaclock7.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/clk/clk-versaclock7.c b/drivers/clk/clk-versaclock7.c index f323263e32c3..96e6b05f2aac 100644 =2D-- a/drivers/clk/clk-versaclock7.c +++ b/drivers/clk/clk-versaclock7.c @@ -1127,8 +1127,11 @@ static int vc7_probe(struct i2c_client *client) node_name =3D client->dev.of_node->name; /* Register APLL */ - apll_rate =3D vc7_get_apll_rate(vc7); apll_name =3D kasprintf(GFP_KERNEL, "%s_apll", node_name); + if (!apll_name) + return -ENOMEM; + + apll_rate =3D vc7_get_apll_rate(vc7); vc7->clk_apll.clk =3D clk_register_fixed_rate(&client->dev, apll_name, __clk_get_name(vc7->pin_xin), 0, apll_rate); =2D- 2.43.0