From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
To: Lidza Louina <lidza.louina@gmail.com>,
Mark Hounschell <markh@compro.net>,
Daeseok Youn <daeseok.youn@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org,
driverdev-devel@linuxdriverproject.org,
devel@driverdev.osuosl.org,
Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Subject: [PATCH 1/2] staging: dgap: fix possible NULL dereference
Date: Thu, 10 Sep 2015 17:24:58 +0530 [thread overview]
Message-ID: <1441886099-24399-1-git-send-email-sudipm.mukherjee@gmail.com> (raw)
The return pointer from dgap_getword() is used in strcmp() where it is
dereferenced. But dgap_getword() can return NULL.
Lets put a check there and return 0 as error.
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
drivers/staging/dgap/dgap.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 9112dd2..20ba258 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -349,6 +349,8 @@ static int dgap_gettok(char **in)
if (strstr(dgap_cword, "board")) {
w = dgap_getword(in);
+ if (!w)
+ return 0;
snprintf(dgap_cword, MAXCWORD, "%s", w);
for (t = dgap_brdtype; t->token != 0; t++) {
if (!strcmp(w, t->string))
--
1.9.1
next reply other threads:[~2015-09-10 11:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-10 11:54 Sudip Mukherjee [this message]
2015-09-10 11:54 ` [PATCH 2/2] staging: dgap: remove unused variable Sudip Mukherjee
2015-09-22 18:45 ` Dan Carpenter
2015-09-12 2:54 ` [PATCH 1/2] staging: dgap: fix possible NULL dereference Greg Kroah-Hartman
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=1441886099-24399-1-git-send-email-sudipm.mukherjee@gmail.com \
--to=sudipm.mukherjee@gmail.com \
--cc=daeseok.youn@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=driverdev-devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=lidza.louina@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=markh@compro.net \
/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
all inboxes | Powered by JetHome®