From patchwork Tue May 30 09:39:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 100710 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2065362vqr; Tue, 30 May 2023 03:06:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6zK2tGMA/UcadMSW5C1w24AQzZ0tFrJz0NJWvjksbGd9HXNQ6XO6HOHBdOnrm96RtXOhLd X-Received: by 2002:a05:6a20:938a:b0:110:2064:ecb with SMTP id x10-20020a056a20938a00b0011020640ecbmr13042189pzh.15.1685441188373; Tue, 30 May 2023 03:06:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685441188; cv=none; d=google.com; s=arc-20160816; b=dnwVNluuD0+zfmIZ8TBZT8Qg/ZM8KS4h4iXZz8OlZU5Tk17xBSvqm11RqwCVJqHnU8 AhecodD8sy5xScS39mqQOzFQ9aWD5ouc0w7YpcJHJHq5CdY9QY6LdClDQN3k6xbWQPBy H6UYlYq6R/tWKaXs+tDkCb2u2lzM9CY5aSZUC1mVlQ6meG48Rv/cBaKtCqmbrETXH6IY taSUzuR3nlpc24vymyQAarVC6o+vEUR54TovMYb5DDGoF+yVAppDFRx7igOMmtJvCG7c 7Fd1BHdFUwilaXtEo6jIgGil35rskVQ/n6f+Dqyq1+FM+gxxfVH+HQOH0gBv2Pm8mVrz ukuA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=CV/n/b8vsNUmVMPHObhOrQXWdZ7udS7FXXre6E54Mpw=; b=JORz72XmITRdA6DWkwBj+zUd3Hyb80BvGkMucf+AjorxJfbWv/IrT+MRko42F4N3JH LnwaTc2FiLAKbw0/eVrmStg20Anjk9R/fckpccIlGkDu/+sdEAwsHuZmrSoka86U8FeM q8oJ67mMbhVtc2tZg6HOviQMX+8qi0Z96TgWpv12S1sNBg1v3a5MvG9tuyeXwoEPAbkX rbG95P62lbEDV6XzwPJinS1F0yJm9jRPLtlv+Wycb7Az1ZxCPn1X/cmmx16vy89YI2uS kNclCz4nM8cqBes8/CDO+Fz9AVq9WfYyDBAmE+f1WyHESTH7PFiZSP/Vy7n536MkW34W Ptjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=cVwNF4zH; 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 y8-20020a63de48000000b0053eef8a4407si5543533pgi.525.2023.05.30.03.06.13; Tue, 30 May 2023 03:06:28 -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=cVwNF4zH; 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 S229755AbjE3Jkv (ORCPT + 99 others); Tue, 30 May 2023 05:40:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230307AbjE3JkR (ORCPT ); Tue, 30 May 2023 05:40:17 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 613ED121; Tue, 30 May 2023 02:40:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1685439611; x=1716975611; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Us7+wlAPXubVAW7Lf48y/+cKX9hpoUoHOhnB94iAUMI=; b=cVwNF4zHOP8wGKS+54uM6LufaKx3AqCEe3w3VZhN+qu8z92J3ZTqd/9y rjBPPJEtAvOykiYe5oz3n8OhMkNSl/UPdp4g/pj4688VmXqbkuhnVnHm1 LJNQY7ZeUKDncKKwhns6ueYQ0hgSIpxHevPeU+WUl3BEWZMg9e41T9oEh RWVi8PJcZWZy7sA8EHoDfZ2GzNolgEFl4psBu+NaA0pqK565hSz9y1I8F S+dQSt5SPEuNAHFWKs/pMoF3/u4p80Nsm9fMre8Ot/I6zs2RTNqH9RtPc aQT6v23yL29CVPVxKe2cL8J1b75w5YAxJQKcJBhj888GhKrklry1I3ALB Q==; X-IronPort-AV: E=Sophos;i="6.00,203,1681196400"; d="scan'208";a="154569092" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 30 May 2023 02:40:09 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex03.mchp-main.com (10.10.85.151) 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:40:06 -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:40:02 -0700 From: Claudiu Beznea To: , , , , , , CC: , , , , , , , , , Claudiu Beznea Subject: [PATCH 6/8] clk: keystone: sci-clk: check return value of kasprintf() Date: Tue, 30 May 2023 12:39:11 +0300 Message-ID: <20230530093913.1656095-7-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230530093913.1656095-1-claudiu.beznea@microchip.com> References: <20230530093913.1656095-1-claudiu.beznea@microchip.com> 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?1767313180007268715?= X-GMAIL-MSGID: =?utf-8?q?1767313180007268715?= kasprintf() returns a pointer to dynamically allocated memory. Pointer could be NULL in case allocation fails. Check pointer validity. Identified with coccinelle (kmerr.cocci script). Fixes: b745c0794e2f ("clk: keystone: Add sci-clk driver support") Depends-on: 96488c09b0f4 ("clk: keystone: sci-clk: cut down the clock name length") Signed-off-by: Claudiu Beznea Reviewed-by: Tony Lindgren --- drivers/clk/keystone/sci-clk.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clk/keystone/sci-clk.c b/drivers/clk/keystone/sci-clk.c index 910ecd58c4ca..6c1df4f11536 100644 --- a/drivers/clk/keystone/sci-clk.c +++ b/drivers/clk/keystone/sci-clk.c @@ -294,6 +294,8 @@ static int _sci_clk_build(struct sci_clk_provider *provider, name = kasprintf(GFP_KERNEL, "clk:%d:%d", sci_clk->dev_id, sci_clk->clk_id); + if (!name) + return -ENOMEM; init.name = name;