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 E5EAD482CB; Mon, 11 Dec 2023 14:02:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JP7D639g" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 574F8C433CC; Mon, 11 Dec 2023 14:02:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702303322; bh=dIioi2bi7bnyNeoBvC0vc3rny0pswu88W/yM/rhZOk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JP7D639gKrpweJ0O6IM9CMNjRFCcqynqo9y/64O5OyEE74PTQCH6T39OAqgqAXvvQ ryPOywILXXcXjdv8vDqURmeMvSj6hAM4mjsolz3bw2DKauY3Sgazl49DVZLGKjdFcM /hcBrwluGEjGdpw0WkmL18OBs9nERucs9TYiJkWB3Ol6o5qgg+q5c10EL4JL6n1knT 1IHt18Te/DkItlG0oTbDINwjNdu3rOap2bQZCms3shjtzWAOpg6Ya0FtdAT3dz2+DY yyT7fFdM2zrZ9XSkJxM1DTvMw0WHWmx12/XdKcySd/ATggjVKWP7U9BbvBJRaUOeou 6pg4u9uNp1h8A== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Xiang Yang , Inki Dae , Sasha Levin , sw0312.kim@samsung.com, kyungmin.park@samsung.com, airlied@gmail.com, daniel@ffwll.ch, krzysztof.kozlowski@linaro.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH AUTOSEL 5.10 15/16] drm/exynos: fix a potential error pointer dereference Date: Mon, 11 Dec 2023 09:00:39 -0500 Message-ID: <20231211140116.391986-15-sashal@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231211140116.391986-1-sashal@kernel.org> References: <20231211140116.391986-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 5.10.203 Content-Transfer-Encoding: 8bit From: Xiang Yang [ Upstream commit 73bf1c9ae6c054c53b8e84452c5e46f86dd28246 ] Smatch reports the warning below: drivers/gpu/drm/exynos/exynos_hdmi.c:1864 hdmi_bind() error: 'crtc' dereferencing possible ERR_PTR() The return value of exynos_drm_crtc_get_by_type maybe ERR_PTR(-ENODEV), which can not be used directly. Fix this by checking the return value before using it. Signed-off-by: Xiang Yang Signed-off-by: Inki Dae Signed-off-by: Sasha Levin --- drivers/gpu/drm/exynos/exynos_hdmi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index dc01c188c0e09..981bffacda243 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -1849,6 +1849,8 @@ static int hdmi_bind(struct device *dev, struct device *master, void *data) return ret; crtc = exynos_drm_crtc_get_by_type(drm_dev, EXYNOS_DISPLAY_TYPE_HDMI); + if (IS_ERR(crtc)) + return PTR_ERR(crtc); crtc->pipe_clk = &hdata->phy_clk; ret = hdmi_create_connector(encoder); -- 2.42.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4EF3DC10F05 for ; Mon, 11 Dec 2023 14:02:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=sj3lW5irpw91aZ1OaBuH5FxYZp2AJkZvmcYKb6a9w0I=; b=rO8eFTExA1DiMz /G3Xf/qwQHRtiQJ2Q0S7f83L2jMm+mwSXIkOwQc2Soz/FgMoCyBLJNFuhcxC0EwIIdfxx57KKX3t+ +UITWtjuH/lVTy8e8lEM2I29YFu9zZ/7B59q5gCzO+zXkhl3RsL49wW9fkorhfFR4gpbea1RO+yk1 mSYIeWYPrvJOINyUcUn3wX91SZvZPcjlGDDe6QbJWlKdTTElsSMhj1drAC5pPzfrcz7MojCBFFvbY ptfBc8+DeZ/FWcWS82DAV2nHd4ZvDspG5ozGIXX4ZRcBirnV9+IyHQ/vgEnGnvu651uJuci8PeCT4 U6Tdhv+IA3PS9WXu6Lcw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rCgrN-0054g0-2A; Mon, 11 Dec 2023 14:02:13 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rCgrD-0054b8-22 for linux-arm-kernel@lists.infradead.org; Mon, 11 Dec 2023 14:02:11 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id EA8AD61015; Mon, 11 Dec 2023 14:02:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 574F8C433CC; Mon, 11 Dec 2023 14:02:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702303322; bh=dIioi2bi7bnyNeoBvC0vc3rny0pswu88W/yM/rhZOk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JP7D639gKrpweJ0O6IM9CMNjRFCcqynqo9y/64O5OyEE74PTQCH6T39OAqgqAXvvQ ryPOywILXXcXjdv8vDqURmeMvSj6hAM4mjsolz3bw2DKauY3Sgazl49DVZLGKjdFcM /hcBrwluGEjGdpw0WkmL18OBs9nERucs9TYiJkWB3Ol6o5qgg+q5c10EL4JL6n1knT 1IHt18Te/DkItlG0oTbDINwjNdu3rOap2bQZCms3shjtzWAOpg6Ya0FtdAT3dz2+DY yyT7fFdM2zrZ9XSkJxM1DTvMw0WHWmx12/XdKcySd/ATggjVKWP7U9BbvBJRaUOeou 6pg4u9uNp1h8A== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Xiang Yang , Inki Dae , Sasha Levin , sw0312.kim@samsung.com, kyungmin.park@samsung.com, airlied@gmail.com, daniel@ffwll.ch, krzysztof.kozlowski@linaro.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH AUTOSEL 5.10 15/16] drm/exynos: fix a potential error pointer dereference Date: Mon, 11 Dec 2023 09:00:39 -0500 Message-ID: <20231211140116.391986-15-sashal@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231211140116.391986-1-sashal@kernel.org> References: <20231211140116.391986-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 5.10.203 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231211_060204_490222_AFFD584C X-CRM114-Status: UNSURE ( 9.57 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Xiang Yang [ Upstream commit 73bf1c9ae6c054c53b8e84452c5e46f86dd28246 ] Smatch reports the warning below: drivers/gpu/drm/exynos/exynos_hdmi.c:1864 hdmi_bind() error: 'crtc' dereferencing possible ERR_PTR() The return value of exynos_drm_crtc_get_by_type maybe ERR_PTR(-ENODEV), which can not be used directly. Fix this by checking the return value before using it. Signed-off-by: Xiang Yang Signed-off-by: Inki Dae Signed-off-by: Sasha Levin --- drivers/gpu/drm/exynos/exynos_hdmi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index dc01c188c0e09..981bffacda243 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -1849,6 +1849,8 @@ static int hdmi_bind(struct device *dev, struct device *master, void *data) return ret; crtc = exynos_drm_crtc_get_by_type(drm_dev, EXYNOS_DISPLAY_TYPE_HDMI); + if (IS_ERR(crtc)) + return PTR_ERR(crtc); crtc->pipe_clk = &hdata->phy_clk; ret = hdmi_create_connector(encoder); -- 2.42.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DC24DC4167B for ; Mon, 11 Dec 2023 14:02:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 528F210E433; Mon, 11 Dec 2023 14:02:05 +0000 (UTC) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6DF3C10E433 for ; Mon, 11 Dec 2023 14:02:03 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id EA8AD61015; Mon, 11 Dec 2023 14:02:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 574F8C433CC; Mon, 11 Dec 2023 14:02:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702303322; bh=dIioi2bi7bnyNeoBvC0vc3rny0pswu88W/yM/rhZOk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JP7D639gKrpweJ0O6IM9CMNjRFCcqynqo9y/64O5OyEE74PTQCH6T39OAqgqAXvvQ ryPOywILXXcXjdv8vDqURmeMvSj6hAM4mjsolz3bw2DKauY3Sgazl49DVZLGKjdFcM /hcBrwluGEjGdpw0WkmL18OBs9nERucs9TYiJkWB3Ol6o5qgg+q5c10EL4JL6n1knT 1IHt18Te/DkItlG0oTbDINwjNdu3rOap2bQZCms3shjtzWAOpg6Ya0FtdAT3dz2+DY yyT7fFdM2zrZ9XSkJxM1DTvMw0WHWmx12/XdKcySd/ATggjVKWP7U9BbvBJRaUOeou 6pg4u9uNp1h8A== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 5.10 15/16] drm/exynos: fix a potential error pointer dereference Date: Mon, 11 Dec 2023 09:00:39 -0500 Message-ID: <20231211140116.391986-15-sashal@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231211140116.391986-1-sashal@kernel.org> References: <20231211140116.391986-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 5.10.203 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sasha Levin , linux-samsung-soc@vger.kernel.org, sw0312.kim@samsung.com, kyungmin.park@samsung.com, dri-devel@lists.freedesktop.org, krzysztof.kozlowski@linaro.org, Xiang Yang , linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Xiang Yang [ Upstream commit 73bf1c9ae6c054c53b8e84452c5e46f86dd28246 ] Smatch reports the warning below: drivers/gpu/drm/exynos/exynos_hdmi.c:1864 hdmi_bind() error: 'crtc' dereferencing possible ERR_PTR() The return value of exynos_drm_crtc_get_by_type maybe ERR_PTR(-ENODEV), which can not be used directly. Fix this by checking the return value before using it. Signed-off-by: Xiang Yang Signed-off-by: Inki Dae Signed-off-by: Sasha Levin --- drivers/gpu/drm/exynos/exynos_hdmi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index dc01c188c0e09..981bffacda243 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -1849,6 +1849,8 @@ static int hdmi_bind(struct device *dev, struct device *master, void *data) return ret; crtc = exynos_drm_crtc_get_by_type(drm_dev, EXYNOS_DISPLAY_TYPE_HDMI); + if (IS_ERR(crtc)) + return PTR_ERR(crtc); crtc->pipe_clk = &hdata->phy_clk; ret = hdmi_create_connector(encoder); -- 2.42.0