From: Joe Moriarty <joe.moriarty@oracle.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: [PATCH v1 1/1] drivers: isdn: NULL pointer dereference [null-pointer-deref] (CWE 476) problem
Date: Thu, 15 Feb 2018 15:27:00 -0500 [thread overview]
Message-ID: <20180215202700.48177-2-joe.moriarty@oracle.com> (raw)
In-Reply-To: <20180215202700.48177-1-joe.moriarty@oracle.com>
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@oracle.com>
Reviewed-by: Jonathan Helman <jonathan.helman@oracle.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
next prev parent reply other threads:[~2018-02-15 20:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-15 20:26 [PATCH v1 0/1] Parfait changes Joe Moriarty
2018-02-15 20:27 ` Joe Moriarty [this message]
2018-02-16 21:11 ` [PATCH v1 1/1] drivers: isdn: NULL pointer dereference [null-pointer-deref] (CWE 476) problem David Miller
2018-02-20 13:47 ` Joe Moriarty
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180215202700.48177-2-joe.moriarty@oracle.com \
--to=joe.moriarty@oracle.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).