Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5047169rwl; Mon, 10 Apr 2023 22:56:36 -0700 (PDT) X-Google-Smtp-Source: AKy350Y8YOcUBG4bMv/llgrMMYXr5N3J+JRmGjLthQPcXfXjq3OnL8vA2E0efYQAvChHqtMDEHmW X-Received: by 2002:a50:eb49:0:b0:4fe:ddf:8d8c with SMTP id z9-20020a50eb49000000b004fe0ddf8d8cmr14069843edp.13.1681192595979; Mon, 10 Apr 2023 22:56:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681192595; cv=none; d=google.com; s=arc-20160816; b=QBcwL8OqkQvEtmX5zVCrHH43D8Mr2BrnTKNFq8jCKTtUbh/7wUq5Q+IPd1y/78ASU4 vvzWpqeLvjNPtAAQquj7JSuzw4a8dVTo447X5xTHCEnrTJ3bzXpZuzASN1KBvGNwdg1h 92oDorloR2SdtmGW+vrQoH2MzA721gWKaYQSbQurqVmKMxeoMQwgUEohCo3HzDLMMcWw jlaJHjsYbwCkP+afxRnDCX0DWVvaxQKPiPEaLdo0iAgfO8I1lcPPIR68uu0n1pgzS+tM I8NmQ0PmCyv1HmKzKkh1jSTohgSyTFRzZTcataEEHhlaaEWpxrxn6PI4ZMLBGDZHMD3Y rxRA== 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=rATucrsos2tqGiaE1yHomrRoPA5q3yHw7OeBD65YDf0=; b=eSugsoKjP1zPW14oYT9kMdDTZ5r5YnyRkr2pldyRwRari5zEHgOKlfwBS6LaIcfXP+ u7Y5HkOSvLu0FcZ9Co+MshUvexGd8Am8XcOJBo+NZK1v+TymZRMNOwRV6isv8pHY0eYu 71oN+lYVP9pkT/7gZr4zvZEX9vzBw8zbGiBSt6J9GgxEi2IBTKezJbBS6M9dDgRO9s38 wSLvYfOfDtZkUWMuPyX8UXqDS6Mz2igHUNmvW7YCRXZ0oI1QbaptREFETe6jBl4qPkN+ ZgxD3rwQ3u05cRI/XRjyNoongz8zbvhLSBdw70Q0Gjz9cmqx/0/waBhCm1YnSy4XEa2f /I9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b="ALlxPA9/"; 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=mediatek.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bc18-20020a056402205200b00504b22290eesi2474334edb.617.2023.04.10.22.56.10; Mon, 10 Apr 2023 22:56:35 -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=@mediatek.com header.s=dk header.b="ALlxPA9/"; 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=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230052AbjDKFyi (ORCPT + 99 others); Tue, 11 Apr 2023 01:54:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229800AbjDKFyb (ORCPT ); Tue, 11 Apr 2023 01:54:31 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7C2CE7A; Mon, 10 Apr 2023 22:54:25 -0700 (PDT) X-UUID: 4c4b8098d82d11edb6b9f13eb10bd0fe-20230411 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=rATucrsos2tqGiaE1yHomrRoPA5q3yHw7OeBD65YDf0=; b=ALlxPA9/Bzk/lPL2MP9TvN1qLCAdFlgH2pbirvxabfgqk8z+OifZv7M6fHMqvdz3tsVssdL5Z20sOMKtFIMR6+s9Uc81hjH7QoZ/Uf7VFes41XiP3ebhJ9wnZA/ek+BPh+8Y8d+4/w22baVDUEAD7Glk2J8B+dsCj29GyrfdxXY=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:741078a6-2142-42fc-9e64-223f0579dd93,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:90 X-CID-INFO: VERSION:1.1.22,REQID:741078a6-2142-42fc-9e64-223f0579dd93,IP:0,URL :0,TC:0,Content:-5,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTIO N:quarantine,TS:90 X-CID-META: VersionHash:120426c,CLOUDID:fd30a683-cd9c-45f5-8134-710979e3df0e,B ulkID:230411135419CKY1X5AP,BulkQuantity:0,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:0,EDM:-3,IP:nil,URL:11|1,File:nil,Bulk:nil,QS:nil,BEC:nil,CO L:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-UUID: 4c4b8098d82d11edb6b9f13eb10bd0fe-20230411 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 721086298; Tue, 11 Apr 2023 13:54:18 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.25; Tue, 11 Apr 2023 13:54:17 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Tue, 11 Apr 2023 13:54:16 +0800 From: Irui Wang To: Hans Verkuil , Mauro Carvalho Chehab , Matthias Brugger CC: , , , , , , Yunfei Dong , "Irui Wang" Subject: [PATCH v2, 2/2] media: mediatek: vcodec: make sure pointer isn't NULL before used Date: Tue, 11 Apr 2023 13:54:13 +0800 Message-ID: <20230411055413.539-3-irui.wang@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411055413.539-1-irui.wang@mediatek.com> References: <20230411055413.539-1-irui.wang@mediatek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY autolearn=unavailable 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 CERT-C Expression check: Dereferencing buf, which is known to be NULL, check buf is not NULL before used. Signed-off-by: Irui Wang --- drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c index d65800a3b89d..db65e77bd373 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c @@ -943,7 +943,7 @@ static int vb2ops_venc_start_streaming(struct vb2_queue *q, unsigned int count) * FIXME: This check is not needed as only active buffers * can be marked as done. */ - if (buf->state == VB2_BUF_STATE_ACTIVE) { + if (buf && buf->state == VB2_BUF_STATE_ACTIVE) { mtk_v4l2_debug(0, "[%d] id=%d, type=%d, %d -> VB2_BUF_STATE_QUEUED", ctx->id, i, q->type, (int)buf->state); -- 2.18.0