From patchwork Tue May 30 09:39:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 10017 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2068654vqr; Tue, 30 May 2023 03:12:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7MHlOodycNmbW9YNYYmEEWjMHiQetuxhn7/8kQrFWsVdsrdK1v1mLI+NelzidWnlw6Gx8y X-Received: by 2002:a17:902:d4c5:b0:1a6:71b1:a0b9 with SMTP id o5-20020a170902d4c500b001a671b1a0b9mr1638454plg.47.1685441557309; Tue, 30 May 2023 03:12:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685441557; cv=none; d=google.com; s=arc-20160816; b=l82G+Y/34aNXFBLm9m4mMqkChgwOp/9USmF32p283lkrKMjHZr++7RgFRlhwYo87W2 j3HrD5rIzgPNNBaQV9zRm5d+c7d7ucc+askcxUYJ9r8cjyBoaCpfUiTVv0f69wZjfU3h GkGnKWl50ahNoWaFIYYFNimDJQOuUgBm4fQp/9NBeqb15TVOGEgpBIjr6VlLNQgTFoKt 1WYQHeHaMKTtHEIF6HPU2cRRwJI56yJkmmrsBoCcQugIWf3GEcJ4HMIPN/ZIy4uxTqRK 20DjcUIynuJVGJDeIluK92m5lNgka1ZsjCmXTe8fa+KVo1kYaKvk28kuwdkXOAVU8A6+ J3BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=hbcy3KmM7jFh63ltGebsE/4TlyGDLX/eI2LX0CJkXJU=; b=o4qID/5wGK0ZQ+gjD+60eoKBKWDR+5G5ZMNywCF5rnMJR1+T9v/KYhzsZ9XRhxyOer tb2VQv2h+ZNSD60/BEdJpmBC3pu4jsPmVAwQlPzfT9/4dHVVQgh/G7nHb/a7zZ4v/uLo KFGTdvSGHAREDJ8sY4bylH8ll98+OCNoxf3aIAWgGNNkpby0Ck195IaqzSF4M5Ot09tE mfoH/q3GdaxD7lBm05yMZPhonNcF+U94Iw65BAD6adze00T/vWp8xI1lF+LURq8g38Ac eQe1d/VVT+JnZCQBBxW12E8mMeZSbeoicFf5fDRsRntJN5OXcnz7pGEng+GLQ1DdZF1u qvwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=2FMHPj05; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l6-20020a170902f68600b001aaec5cffb2si1067693plg.280.2023.05.30.03.12.25; Tue, 30 May 2023 03:12:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=2FMHPj05; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230233AbjE3Jjl (ORCPT + 99 others); Tue, 30 May 2023 05:39:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229550AbjE3Jjk (ORCPT ); Tue, 30 May 2023 05:39:40 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 299BBFC; Tue, 30 May 2023 02:39:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1685439577; x=1716975577; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=EilXIOvUaLl6Wbm/Y1NuawMKvR7ssqkmCU3WRLSqQPs=; b=2FMHPj05fwHXm5WAAun6rvJUVbsgFB+m6GteUEJ1R9YycQJJpc0QzyBu m6K2QWC4UEhmn1iaDEbwJ/jNJVFpbo16eUsol62ErHBn2W3GCPmKanR1n 8e6thTzVkpSoVw3nwEnSEMEdgEj4SK06ZxLZokowgkVnECerM7Qw78taR qdFoM7PBypOiocFvrc7HZNpR1tqdVGvf3CmwWd5AyGXT2nunPUiPt7hPr W/PTkI72iL96OaSy7DgvhmxOEj0NzOmjU067QdYCt5miEmRKjpbzbOcuA YVD/Ij9cblbJNiOnnJhZm2iEHoZHTHzFIPnhhA4OHDFdaAirmQdeEbPru Q==; X-IronPort-AV: E=Sophos;i="6.00,203,1681196400"; d="scan'208";a="217918973" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 30 May 2023 02:39:36 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Tue, 30 May 2023 02:39:35 -0700 Received: from m18063-ThinkPad-T460p.mchp-main.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Tue, 30 May 2023 02:39:31 -0700 From: Claudiu Beznea To: , , , , , , CC: , , , , , , , , , Claudiu Beznea Subject: [PATCH 0/8] clk: check memory returned by {devm_}kasprintf() Date: Tue, 30 May 2023 12:39:05 +0300 Message-ID: <20230530093913.1656095-1-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767313566439653318?= X-GMAIL-MSGID: =?utf-8?q?1767313566439653318?= Hi, While browsing some code I noticed that there are places where pointer returned by devm_kasprintf() or kasprintf() is not checked. Thus I've tooked the chance and fixed this (by updating kmerr.cocci script, changes published at [1]). Along with it some other places where resources may need to be freed on failure paths were updated. Thank you, Claudiu Beznea [1] https://lore.kernel.org/all/20230530074044.1603426-1-claudiu.beznea@microchip.com/ Claudiu Beznea (8): clk: vc5: check memory returned by kasprintf() clk: cdce925: check return value of kasprintf() clk: si5341: return error if one synth clock registration fails clk: si5341: check return value of {devm_}kasprintf() clk: si5341: free unused memory on probe failure clk: keystone: sci-clk: check return value of kasprintf() clk: ti: clkctrl: check return value of kasprintf() clk: clocking-wizard: check return value of devm_kasprintf() drivers/clk/clk-cdce925.c | 12 +++++++ drivers/clk/clk-si5341.c | 38 +++++++++++++--------- drivers/clk/clk-versaclock5.c | 29 +++++++++++++++++ drivers/clk/keystone/sci-clk.c | 2 ++ drivers/clk/ti/clkctrl.c | 7 ++++ drivers/clk/xilinx/clk-xlnx-clock-wizard.c | 5 +++ 6 files changed, 78 insertions(+), 15 deletions(-)