From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 825EA8494 for ; Thu, 5 Jan 2023 13:01:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC470C433D2; Thu, 5 Jan 2023 13:01:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1672923663; bh=lgma8Tgl+J2+lEuaJCNZpoav5V2deWosuXj0giNjuCA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=glNaqRJQpQ9QWy3kN3jBdOMNFXMkojsNX3mMMpkbNkl4AFa71zkVG9TCm8WfqzBtS TDuT5RiCbHhJvsAZb2jFSS6Wc268TYSu5EDXSG3CiSc1woDDGSJa0JSjD8Sfm4JHCd bvQcRKulIl9R1x67Om4sJ0yR86QB6WXUivPHsrXo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jiasheng Jiang , Hans Verkuil , Sasha Levin Subject: [PATCH 4.9 091/251] media: coda: Add check for dcoda_iram_alloc Date: Thu, 5 Jan 2023 13:53:48 +0100 Message-Id: <20230105125338.962280799@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230105125334.727282894@linuxfoundation.org> References: <20230105125334.727282894@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Jiasheng Jiang [ Upstream commit 6b8082238fb8bb20f67e46388123e67a5bbc558d ] As the coda_iram_alloc may return NULL pointer, it should be better to check the return value in order to avoid NULL poineter dereference, same as the others. Fixes: b313bcc9a467 ("[media] coda: simplify IRAM setup") Signed-off-by: Jiasheng Jiang Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin --- drivers/media/platform/coda/coda-bit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c index 7b4c93619c3d..b62c7098fc8c 100644 --- a/drivers/media/platform/coda/coda-bit.c +++ b/drivers/media/platform/coda/coda-bit.c @@ -595,7 +595,7 @@ static void coda_setup_iram(struct coda_ctx *ctx) /* Only H.264BP and H.263P3 are considered */ iram_info->buf_dbk_y_use = coda_iram_alloc(iram_info, w64); iram_info->buf_dbk_c_use = coda_iram_alloc(iram_info, w64); - if (!iram_info->buf_dbk_c_use) + if (!iram_info->buf_dbk_y_use || !iram_info->buf_dbk_c_use) goto out; iram_info->axi_sram_use |= dbk_bits; @@ -619,7 +619,7 @@ static void coda_setup_iram(struct coda_ctx *ctx) iram_info->buf_dbk_y_use = coda_iram_alloc(iram_info, w128); iram_info->buf_dbk_c_use = coda_iram_alloc(iram_info, w128); - if (!iram_info->buf_dbk_c_use) + if (!iram_info->buf_dbk_y_use || !iram_info->buf_dbk_c_use) goto out; iram_info->axi_sram_use |= dbk_bits; -- 2.35.1