From patchwork Tue Oct 27 13:53:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 312188 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93F8BC64E7B for ; Tue, 27 Oct 2020 16:56:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 477E3218AC for ; Tue, 27 Oct 2020 16:56:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603817811; bh=u+P8taGnXTkfA+jbB0zYHAsYbU+dXSCyDapA67S5iXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=CKEQI8RljDjBymHCKGZk4+aV740wBsaGV1wW+dWnY6NbGvKsNOZ22sNF9UJZ49FIe zgT72pQq4FnEtylVS6TLPnTelkrs5J3KNTsZJNgSa6HZUize1mqtvSZ2Avxjz+QFH+ zGJJejhFGM+zevCA77g3sdNiLvgJgUbDbJDJlsw8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1814522AbgJ0Q4t (ORCPT ); Tue, 27 Oct 2020 12:56:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:45956 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1789833AbgJ0PKR (ORCPT ); Tue, 27 Oct 2020 11:10:17 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7F2D62072E; Tue, 27 Oct 2020 15:10:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603811417; bh=u+P8taGnXTkfA+jbB0zYHAsYbU+dXSCyDapA67S5iXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nHR4X/KOjjLQDqHhQoSP69M/cidbGXX/TyUwCmZuX0/rDRE5PsclGYa1IqOkv4Lcg wFJcyrCrO6XU6vVkpOyPFM1sgVpYt/OYBaR62tfQm8J0KKjKMeJw95ThvInYPKfeeX IjDLhNJoN4IUCagva2Yr4Fn7wdIPRbWSYeDVDERg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.8 445/633] remoteproc/mediatek: fix null pointer dereference on null scp pointer Date: Tue, 27 Oct 2020 14:53:08 +0100 Message-Id: <20201027135543.598129402@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Colin Ian King [ Upstream commit 434ac4d51407ce3764a6ae96a89d90b8ae2826fb ] Currently when pointer scp is null a dev_err is being called that references the pointer which is the very thing we are trying to avoid doing. Remove the extraneous error message to avoid this issue. Addresses-Coverity: ("Dereference after null check") Fixes: 63c13d61eafe ("remoteproc/mediatek: add SCP support for mt8183") Signed-off-by: Colin Ian King Link: https://lore.kernel.org/r/20200918152428.27258-1-colin.king@canonical.com Signed-off-by: Bjorn Andersson Signed-off-by: Sasha Levin --- drivers/remoteproc/mtk_scp_ipi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/remoteproc/mtk_scp_ipi.c b/drivers/remoteproc/mtk_scp_ipi.c index 3d3d87210ef2c..58d1d7e571d66 100644 --- a/drivers/remoteproc/mtk_scp_ipi.c +++ b/drivers/remoteproc/mtk_scp_ipi.c @@ -30,10 +30,8 @@ int scp_ipi_register(struct mtk_scp *scp, scp_ipi_handler_t handler, void *priv) { - if (!scp) { - dev_err(scp->dev, "scp device is not ready\n"); + if (!scp) return -EPROBE_DEFER; - } if (WARN_ON(id >= SCP_IPI_MAX) || WARN_ON(handler == NULL)) return -EINVAL;