Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp693300pxb; Tue, 5 Apr 2022 19:03:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyt+UczvKCTbHvDOpUEtlPiVu8LEd/XUHSf50ubWmyQBt806bA9XPO9BYsfempSZX6i+Uba X-Received: by 2002:a17:902:b183:b0:14f:c266:20d5 with SMTP id s3-20020a170902b18300b0014fc26620d5mr6418976plr.136.1649210587885; Tue, 05 Apr 2022 19:03:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649210587; cv=none; d=google.com; s=arc-20160816; b=VsHQE3Bz93REqjkrQ7uewvveIwnr0MmNbFY9oKjtIufyudwCb1oDofCnpBUFC695fB 0yf9fPEe1nzGt8rixi9LDKgG5y71iSytjL7o4JiY7EANuyuyJr0UgpqowIcjbTAusr/M 3dI+nmKsGybjmWMwL313tNcVEgeFN0jW9q1CcuBnb2JffBghBwjv0PYofeFzG16D6q9A N07aw77klA6+gyj/9Q22DhzLxUYPhVt0XGxwCEmGuHwYZwjo6tHJNb2/gft/n91Tk1wU nrSlijxEUHOHZ+9cETcHoBi89CZLLwLBf+c0jY6/5+GFP4+EtVlfxyLM+5yt2Xjelfyu 5SSQ== 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=zve47YqL6S9qDXp2SHenXJYGyviodjRXORmjQ6HiubS3D0jVrtcvBGlJtUmm2avQ+F 36Sg/UNBSDGYNMw8ZrOFt3yJVOR/JuXABOHrcb2e6qCCtniSqEusN7FqOydhu0hEvtcf trkhJWTo9wdOLoojLVWkRJe02z1egRBE1IfP1oAcy7L/+Z6nnVRHz0GNM8X6Y4crJ2Ny ffyaW1YOsf7hTPump+ttyuoYsEYWrdbMHXuj51+geYA9+7rFLJZEoC2T6n9pArvpgbqS 3oVjvVwqrkpJUzXf8wCejRabvB+SLucVH3c0BWQJ6dPwTeFPi5WdOoLCCBAMmpCn5PfL MiMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="dU69/yyI"; 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 j19-20020a62b613000000b004fa3a8e005esi13334610pff.277.2022.04.05.19.02.50; Tue, 05 Apr 2022 19:03:07 -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="dU69/yyI"; 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 S1379232AbiDELkg (ORCPT + 99 others); Tue, 5 Apr 2022 07:40:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244791AbiDEIwj (ORCPT ); Tue, 5 Apr 2022 04:52:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 049C71DA7F; Tue, 5 Apr 2022 01:44:02 -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 951496117A; Tue, 5 Apr 2022 08:44:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F792C385A0; Tue, 5 Apr 2022 08:44:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649148241; bh=GOCjvPSffRKuugb0uITMfSMEobaooJl1sG41hMr87RY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dU69/yyIqs6voWRaD3Ov7ar1Yp/26QT0EhbyqpPOa544ZmzAYZ47dKUINLaOd8xJ8 UDuvRpoOf+RnZisYF0/d0kd5egHmf65pPB/JC+BSEF/Oh1yJMQeOlhqN9ZCZ/gVDoY 4+TEGqkAniWMszxfmnqKLK/0+rdAjrxOjic2guVU= 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.16 0285/1017] media: mtk-vcodec: potential dereference of null pointer Date: Tue, 5 Apr 2022 09:19:58 +0200 Message-Id: <20220405070402.730368977@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@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