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-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 15 Feb 2018 15:27:00 -0500
From:   Joe Moriarty <joe.moriarty@...cle.com>
To:     davem@...emloft.net
Cc:     netdev@...r.kernel.org
Subject: [PATCH v1 1/1] drivers: isdn: NULL pointer dereference [null-pointer-deref] (CWE 476) problem

The Parfait (version 2.1.0) static code analysis tool found the
following NULL pointer dereference problem.

- drivers/isdn/mISDN/core.c
function channelmap_show() does not check the returned mdev
variable from dev_to_mISDN() for NULL.  Added the check for
NULL, which results in a value of 0 being returned.

Signed-off-by: Joe Moriarty <joe.moriarty@...cle.com>
Reviewed-by: Jonathan Helman <jonathan.helman@...cle.com>
---
 drivers/isdn/mISDN/core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/isdn/mISDN/core.c b/drivers/isdn/mISDN/core.c
index faf505462a4f..aec7e2706109 100644
--- a/drivers/isdn/mISDN/core.c
+++ b/drivers/isdn/mISDN/core.c
@@ -129,8 +129,10 @@ static ssize_t channelmap_show(struct device *dev,
 	char *bp = buf;
 	int i;
 
-	for (i = 0; i <= mdev->nrbchan; i++)
-		*bp++ = test_channelmap(i, mdev->channelmap) ? '1' : '0';
+	if (mdev)
+		for (i = 0; i <= mdev->nrbchan; i++)
+			*bp++ = test_channelmap(i, mdev->channelmap) ?
+				'1' : '0';
 
 	return bp - buf;
 }
-- 
2.15.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ