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]
Date:   Fri,  8 Dec 2017 00:03:07 +0100
From:   Vasyl Gomonovych <gomonovych@...il.com>
To:     viro@...iv.linux.org.uk, linux-fsdevel@...r.kernel.org,
        gomonovych@...il.com
Cc:     linux-kernel@...r.kernel.org
Subject: [PATCH] fs/seq_file: Fix warning of passing zero to 'PTR_ERR'

p could be NULL and passing into PTR_ERR

Signed-off-by: Vasyl Gomonovych <gomonovych@...il.com>
---
 fs/seq_file.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/seq_file.c b/fs/seq_file.c
index 4be761c..8b700b9 100644
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -262,8 +262,8 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos)
 		size_t offs = m->count;
 		loff_t next = pos;
 		p = m->op->next(m, p, &next);
-		if (!p || IS_ERR(p)) {
-			err = PTR_ERR(p);
+		if (IS_ERR(p)) {
+			err = (!p ? -EFAULT : PTR_ERR(p));
 			break;
 		}
 		err = m->op->show(m, p);
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ