Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1842082pxb; Mon, 13 Sep 2021 06:44:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxOFJZ32n+TfNFYNoyi/teWtGVcN0nlmI5bI/w1o1atUW8oZGmM5Rbtz0epjoq5391d0z9 X-Received: by 2002:a02:1608:: with SMTP id a8mr9783841jaa.36.1631540693242; Mon, 13 Sep 2021 06:44:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631540693; cv=none; d=google.com; s=arc-20160816; b=Qr8rGGxvnOMQ4Kng0kVopGMQLlbJ9ZGzOlWc2Og1V62HW2cuTGE727dPyDW8vn3kqs 3Z5YtClhmO6vnve9lWZDkeXy7lILrcVueh7WGTwQikMdwRu4TAyCXgO9Q0AS9Z3LqtiT 0+tg924vWhhAuS0NZ2lnD1FuFQTb2CowvH8eMuU75MUeCkrMJMPTiTHG9Cs5++2hPaOL QGupgPfE3SaauyjUyJnfRgX4If8R/lwILO93CY27I6z6Q/y1ckJxMQx1SmSpjko4Mn0h UfnJuzvDOYAOdRUdDswX+pwdib9N7sBqZ3K9vs0iyusH3qbj5NyCAwY5ZR9v92NG6ujO 9UsQ== 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=RTTpvZQbIWq5G7kHFCUY7IMf33Dj8cAR7HKRgnCnD04=; b=ixUN/HrqzN7kYPfVJwN+TgYnjvkA0v1AVacdiDL43P7/bxM70RqAjsZfCExIQWTKls e19hYong+Q4AKfEL029g6taMWYn6XnOcr8/+0dGjH30ks54Fk6TobJJBGPQQx/4EGnrr zW0683ALSFmMt0J1bLL1uen4b2nJX25odiI4NlFJG8RZ8K5hKID/Blfo6HEL9m3nrL90 DA/2NLoRHiDLF0VJVs+n3tKmwo7nI7rqOU2jZMqQcdvrfejEPZ0pibY6FBNC2XTamyPQ D2TI4xWBFX7PNASm8aAhBSAitNbXnSgPAoXVfEeH/Q22m0+3JzAXDcMpJ7GCWnM1qkXX BRUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uyLpb4+m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v2si6665040iot.49.2021.09.13.06.44.36; Mon, 13 Sep 2021 06:44:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uyLpb4+m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S242458AbhIMNnP (ORCPT + 99 others); Mon, 13 Sep 2021 09:43:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:37682 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243112AbhIMNiS (ORCPT ); Mon, 13 Sep 2021 09:38:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 22A52613CE; Mon, 13 Sep 2021 13:28:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539696; bh=54opRNZffh/YZmHEJUAs+p6fS++AsL+5onCIpjO2XTs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uyLpb4+mF+bYHWhKmdkqbArGO0vaWLf7nxOz5NNbWYVwK9Ug7KDxJ/PU57QWRSL0j 3Fzsm+Ju6CkQNA96lcILodjizg7aXl90JT5/xInbO5efMs8tXByYdTjQ46MCtrBxw6 wYSUMOcfFq4wvv9OwFoWZb6ftfexER4ttKN6D36Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Stanimir Varbanov , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.10 124/236] media: venus: venc: Fix potential null pointer dereference on pointer fmt Date: Mon, 13 Sep 2021 15:13:49 +0200 Message-Id: <20210913131104.578335783@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131100.316353015@linuxfoundation.org> References: <20210913131100.316353015@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King [ Upstream commit 09ea9719a423fc675d40dd05407165e161ea0c48 ] Currently the call to find_format can potentially return a NULL to fmt and the nullpointer is later dereferenced on the assignment of pixmp->num_planes = fmt->num_planes. Fix this by adding a NULL pointer check and returning NULL for the failure case. Addresses-Coverity: ("Dereference null return") Fixes: aaaa93eda64b ("[media] media: venus: venc: add video encoder files") Signed-off-by: Colin Ian King Signed-off-by: Stanimir Varbanov Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/qcom/venus/venc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 47246528ac7e..e2d0fd5eaf29 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -183,6 +183,8 @@ venc_try_fmt_common(struct venus_inst *inst, struct v4l2_format *f) else return NULL; fmt = find_format(inst, pixmp->pixelformat, f->type); + if (!fmt) + return NULL; } pixmp->width = clamp(pixmp->width, frame_width_min(inst), -- 2.30.2