Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp670307pxb; Tue, 5 Apr 2022 18:06:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxp2ecDQ2c+AQUzPWl5WFeEGPtFffCjbZgTIflPFqsCZ2rhKXwzcG/UJ63Uagt3Mt2OwgHT X-Received: by 2002:a17:907:c11:b0:6e6:f1f3:ba76 with SMTP id ga17-20020a1709070c1100b006e6f1f3ba76mr5997420ejc.671.1649207186121; Tue, 05 Apr 2022 18:06:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649207186; cv=none; d=google.com; s=arc-20160816; b=ieXJHCzHdqyRcTENddPhVLQ4JB5kk7blHLTXu0gB8ltHUOEfEURC/Qcso9vW2BWAHx 9eiWPnVXiZ56tD1TBolEHtNFYIqK6pTNhITnxGn993A7eQi3Cu52W90bzxvbSFke3F77 E3YwnVMUnkZe900v3Fqfxdo1qx0vmMv7IMeW1WJngHvO9ANONGlZ6gjni4esNzWjDZYE Dj+QKmh3iulWrYPX4Yw2EJeVGZomcQkEvVuUfRtSGCXwLWZb/gwOLYgMVhZCnK5/i/tX xY2MzYsTi79dlWGeQTNfvsQ8FWf03K71vZxdMCYEqm4NdSgLlGaYsO+GzI9KFEB2sz9G 0T/w== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IBuWcbacFIWlRzggL7i6eQhXizvFkrjFemjarbF2Ot0=; b=g7wI/75qaWLur3uStMbdTMmjOHllZb65IXwZzDzWhRVymfSlPF7/Q9ylg1rXqZRfqh VkkwPmGEduEeTkJzUxzV0NbWuFqkblNS1UmkCF6AZrYHpfcljcX/3zyL+oF7rlGUd+n0 FoticnrKwCEeqJRTYsp+dlXIwxWNcyXvSyeAq27roQwY6Bt2cpmEHJmE25Sb7SQf9X7E rN3mJNjkudrsVERSbVmSv1/5Xd+BRIlf3O2wQCclISSHa5eHDCojMD0sNkXsoufYf55z q9X9432ucVgVjXpP6t2DEUeFZzVsGYFVX6iuPAfVx59sQ38ecetxNaFBC9eWK3z0xF+s sNdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DFjhrFnd; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l9-20020aa7d949000000b00418c2b5beabsi10392215eds.397.2022.04.05.18.06.00; Tue, 05 Apr 2022 18:06:26 -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=@linuxfoundation.org header.s=korg header.b=DFjhrFnd; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234653AbiDEINs (ORCPT + 99 others); Tue, 5 Apr 2022 04:13:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234525AbiDEH6h (ORCPT ); Tue, 5 Apr 2022 03:58:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 028DCA206F; Tue, 5 Apr 2022 00:52:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D79E3615CD; Tue, 5 Apr 2022 07:52:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1F4CC340EE; Tue, 5 Apr 2022 07:52:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649145160; bh=GOCjvPSffRKuugb0uITMfSMEobaooJl1sG41hMr87RY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DFjhrFndNTtwnk9KW9LX0ih3vi6b+agwKBbRi4jbCrthXkvHpDUpIn24CAj0HuxIJ f+dUn8PXaCnG4uQrYxQTWsTcfpeeP0CVl5p8D04bpeDlnZ4QBzzTwMUH0hKtH6fT3Z nB2VzQktOazP7NKJgsR0Iur/LbePWCrYddS9rnGY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Tzung-Bi Shih , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.17 0299/1126] media: mtk-vcodec: potential dereference of null pointer Date: Tue, 5 Apr 2022 09:17:26 +0200 Message-Id: <20220405070416.391840149@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070407.513532867@linuxfoundation.org> References: <20220405070407.513532867@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Jiasheng Jiang [ Upstream commit e25a89f743b18c029bfbe5e1663ae0c7190912b0 ] The return value of devm_kzalloc() needs to be checked. To avoid use of null pointer in case of thefailure of alloc. Fixes: 46233e91fa24 ("media: mtk-vcodec: move firmware implementations into their own files") Signed-off-by: Jiasheng Jiang Reviewed-by: Tzung-Bi Shih Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/mtk-vcodec/mtk_vcodec_fw_vpu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_fw_vpu.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_fw_vpu.c index cd27f637dbe7..cfc7ebed8fb7 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_fw_vpu.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_fw_vpu.c @@ -102,6 +102,8 @@ struct mtk_vcodec_fw *mtk_vcodec_fw_vpu_init(struct mtk_vcodec_dev *dev, vpu_wdt_reg_handler(fw_pdev, mtk_vcodec_vpu_reset_handler, dev, rst_id); fw = devm_kzalloc(&dev->plat_dev->dev, sizeof(*fw), GFP_KERNEL); + if (!fw) + return ERR_PTR(-ENOMEM); fw->type = VPU; fw->ops = &mtk_vcodec_vpu_msg; fw->pdev = fw_pdev; -- 2.34.1