lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230821062159.198691-1-suhui@nfschina.com>
Date:   Mon, 21 Aug 2023 14:22:00 +0800
From:   Su Hui <suhui@...china.com>
To:     airlied@...hat.com, tzimmermann@...e.de, airlied@...il.com,
        daniel@...ll.ch
Cc:     eich@...e.de, tiwai@...e.de, dri-devel@...ts.freedesktop.org,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
        Su Hui <suhui@...china.com>
Subject: [PATCH] drm/ast: Avoid possible NULL dereference

smatch error:
drivers/gpu/drm/ast/ast_dp501.c:227 ast_launch_m68k() error:
we previously assumed 'ast->dp501_fw' could be null (see line 223)

when "!ast->dp501_fw" and "ast_load_dp501_microcode(dev) >= 0" is true,
there will be a NULL dereference of 'ast->dp501_fw'.

Fixes: 12f8030e05c6 ("drm/ast: Actually load DP501 firmware when required")
Signed-off-by: Su Hui <suhui@...china.com>
---
 drivers/gpu/drm/ast/ast_dp501.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/ast/ast_dp501.c b/drivers/gpu/drm/ast/ast_dp501.c
index 1bc35a992369..d9f3a0786a6f 100644
--- a/drivers/gpu/drm/ast/ast_dp501.c
+++ b/drivers/gpu/drm/ast/ast_dp501.c
@@ -224,8 +224,10 @@ static bool ast_launch_m68k(struct drm_device *dev)
 			    ast_load_dp501_microcode(dev) < 0)
 				return false;
 
-			fw_addr = (u8 *)ast->dp501_fw->data;
-			len = ast->dp501_fw->size;
+			if (ast->dp501_fw) {
+				fw_addr = (u8 *)ast->dp501_fw->data;
+				len = ast->dp501_fw->size;
+			}
 		}
 		/* Get BootAddress */
 		ast_moutdwm(ast, 0x1e6e2000, 0x1688a8a8);
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ