Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp704757pxb; Tue, 5 Apr 2022 19:33:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUsjb6nkHUCQPzwwzrlWPhXhkGyj8RuslPwa9OfmzA4OyC1NZPYCpWGGjFnHypucDDgeMt X-Received: by 2002:a17:90b:4a92:b0:1c7:5aa4:2a74 with SMTP id lp18-20020a17090b4a9200b001c75aa42a74mr7425662pjb.239.1649212397427; Tue, 05 Apr 2022 19:33:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649212397; cv=none; d=google.com; s=arc-20160816; b=aWWXPYymXPa8giWtQ/uAV8yFza+P7Di9bMoYCN0S/LcGGo0cSgoLbhjIOWsnlgbo53 HjFoLitDUnSf+6V35Ab4ZdEYUIRF+Gc7mXPw0ObCLkYFKUzZjc4lkDXWJfzlBxgZ2wfx wLuJfgTb81KCOSNqki2TjcYIcKXtzGO4G2DJWjrbXqNZo6vMw8A2kBHlixkV3M7u011i R3hPPRvjn7p81wq1qbX1naNDcw0M8It1OBR2j2So+DohSxghY1YvP3cr1s8mzKjVtTXU zWMSeA7XkUPNn8qVlE+LVW8QnWJu9kg/ze49TF2PcQIs/gumh4Pr1BqvdohX4w3foMxK Dq4A== 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=yrysfk8VvQRUWnVSegZXzOBcGDSchozWmhmugqQFt96updj82mrAHdXn+YkcH9tFc8 DebfyOWq8Gdthd3dQW04wV8MKY9el34Nh+IqKTZ4ANM9WcYErFQQWfFYNiEp0FKBYTNJ ZnVPoYxgUMOghHJAsS+pEWbUt32ht7p8G1/BXBXWyB4Cc3goGGpOWavM1cL109IOCvLk Ve/p2QkKT1ejWs5lqCK53NFCSpFrPPgp30b4gLHEZNVNt21dZfHL5BffqiP6KrcbBcvT UF6d0nS2SS93c6SFuwcRj6mKYwpfh7U22m+FeoNBzBcnpN5v2q68tTNwnCtMqypjWKDT jXXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HToBeCZA; 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 n11-20020a170902f60b00b001568ab4ba1dsi9757519plg.301.2022.04.05.19.33.01; Tue, 05 Apr 2022 19:33:17 -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=HToBeCZA; 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 S1380429AbiDEPNo (ORCPT + 99 others); Tue, 5 Apr 2022 11:13:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346457AbiDEJpE (ORCPT ); Tue, 5 Apr 2022 05:45:04 -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 03EFCDA0B1; Tue, 5 Apr 2022 02:30: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 9362661368; Tue, 5 Apr 2022 09:30:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9C12C385A2; Tue, 5 Apr 2022 09:30:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649151040; bh=GOCjvPSffRKuugb0uITMfSMEobaooJl1sG41hMr87RY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HToBeCZAY3ziKVXeWYvcdVl+lx4lisKoMhvdjrHOmkVuS6tGdem9jxwjdffCx4m25 JURBQN4wxmdXv4bc5Dp7dW2kmPd3sNa5gzkOAFfVCP5X81u/oD+UTLBfoTS/pjn4Ko fCMoUX6JVgXYZZmRr/8gxBZ2HS/EIANYs+b19loQ= 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.15 272/913] media: mtk-vcodec: potential dereference of null pointer Date: Tue, 5 Apr 2022 09:22:14 +0200 Message-Id: <20220405070348.012092957@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@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