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>] [day] [month] [year] [list]
Message-Id: <20221107073323.1283046-1-speakshen@163.com>
Date:   Mon,  7 Nov 2022 15:33:23 +0800
From:   SPeak Shen <speakshen@....com>
To:     Xinhui.Pan@....com, airlied@...il.com, daniel@...ll.ch
Cc:     amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
        linux-kernel@...r.kernel.org, shenyanfeng <shenyanfeng@...omi.com>,
        SPeak <speakshen@....com>
Subject: [PATCH] driver: gpu: add failure check for ftell

From: shenyanfeng <shenyanfeng@...omi.com>

add return-value check of ftell to improve robustness(and avoid abnormal behavior)

Signed-off-by: SPeak <speakshen@....com>
Signed-off-by: shenyanfeng <shenyanfeng@...omi.com>
---


Receive "Undelivered Mail Returned to Sender", so send again


 drivers/gpu/drm/radeon/mkregtable.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/mkregtable.c b/drivers/gpu/drm/radeon/mkregtable.c
index 52a7246fe..c31c58e5f 100644
--- a/drivers/gpu/drm/radeon/mkregtable.c
+++ b/drivers/gpu/drm/radeon/mkregtable.c
@@ -193,6 +193,7 @@ static int parser_auth(struct table *t, const char *filename)
 	regmatch_t match[4];
 	char buf[1024];
 	size_t end;
+	long pos;
 	int len;
 	int done = 0;
 	int r;
@@ -228,12 +229,12 @@ static int parser_auth(struct table *t, const char *filename)
 	last_reg = strtol(last_reg_s, NULL, 16);
 
 	do {
-		if (fgets(buf, 1024, file) == NULL) {
+		if ((fgets(buf, 1024, file) == NULL) || (pos = ftell(file)) < 0) {
 			fclose(file);
 			return -1;
 		}
 		len = strlen(buf);
-		if (ftell(file) == end)
+		if (pos == end)
 			done = 1;
 		if (len) {
 			r = regexec(&mask_rex, buf, 4, match, 0);
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ