Received: by 2002:a05:6520:4d:b0:139:a872:a4c9 with SMTP id i13csp2568626lkm; Mon, 20 Sep 2021 18:57:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRSk42loPDqddYiPdAh3AWUwUtYhsSS8u0mWLBUZJLPctDQoV5xeqYQ0BpJ66Mb+qfD2RW X-Received: by 2002:a92:ca06:: with SMTP id j6mr2518789ils.243.1632188980827; Mon, 20 Sep 2021 18:49:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632188980; cv=none; d=google.com; s=arc-20160816; b=IWTdKxnBptAdAdbSH2aTrRDT3wQbbSZSkqh2H9nGfvw+UN6rjXoaDa2wXqBUHw4tG6 QV0m2OyxQ8VKUuoYYpqIU5KVDpUGgPDADzTKZug4RjpimqRXx7kpS6UH1/yyeLYgoRAn wmSfAd2izVFi9YL5awZGKb3LfQxEKrL6oQmrTX70mr6SKSWv1mANHmmiIpgxj5V/qGqq KeJS2xLs0+MgvzkGGD6dDEOV6B6yZk+Y0nwi2bW8UYoMGXdtVwt2OrCNBANHmfSuKkxW 3e7MDBaiq8fSV3vw/MLvlHheviVUfmv3VRQUP1WkfCGzqU/4qGSJFRuHpVNgmrlhdPff 6bRg== 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=Vw9r7vRZj+IuqoYqvhG+tT3Goa8k2S7DHPiYYvNZF2c=; b=FZJ83wlqtTr4zEF/nVythkooByrGm0V188psdY/L1fbuCmycxnsTF8VIzFTGPtOFik CiFqmxv1o10umA1wddVBsDr4VBzGzKSWNqiyXeaYpbYA6jBu0R7ed7hsv5e1BOA5R76i P5s0k0HrBSCRpYQcNFLn+MUfal1RrxP2izlkLg2nfRLSmM3wDgKraAlrESlFaGmGxGNK RJQVWjqH81vUtoIotn2EHcTMfJywQAFsWAwD34Jdb8jxyJFHMI4Iee+5Pdwgovif76yU 3TgpSstpYtoPaMnel8qWqpjOJE/qCCmFz6sCSOPzy2pzGGGMJWzH2L40zTYM0zh7Y3Iv WXzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uiLjVL6I; 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 r17si13215917ilh.21.2021.09.20.18.49.29; Mon, 20 Sep 2021 18:49:40 -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=uiLjVL6I; 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 S1352852AbhITRmU (ORCPT + 99 others); Mon, 20 Sep 2021 13:42:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:43960 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348726AbhITRkU (ORCPT ); Mon, 20 Sep 2021 13:40:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EA6B161B4D; Mon, 20 Sep 2021 17:08:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632157685; bh=oaM9gqEkDMFrfCAXnzQaMwhPjwbOtbUBM4CxGZCdwvU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uiLjVL6IzzHt72MLQXXVH0EDAuURa+gjHBHCrIS7N/6CT81QBC+2O6nQj8WvMUnl5 BJsxUccLo0/f4SX7JVE+txeGGjzrowYNkj1DgGg60+dPtDO7LosXKfeSMGIeWdxSuY erArgrFrWuvTfnkIxqOdW3EldbDnLchTJWW9By/g= 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 4.19 072/293] media: venus: venc: Fix potential null pointer dereference on pointer fmt Date: Mon, 20 Sep 2021 18:40:34 +0200 Message-Id: <20210920163935.727773001@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163933.258815435@linuxfoundation.org> References: <20210920163933.258815435@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 420897241248..4197b311cff4 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -316,6 +316,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