summaryrefslogtreecommitdiff
path: root/drivers/staging/dgap
diff options
context:
space:
mode:
authorSudip Mukherjee <sudipm.mukherjee@gmail.com>2015-09-10 17:24:58 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-09-12 18:24:57 -0700
commit39be6b8b0cc84b33cd17bc570e80a25126f87c9c (patch)
tree7fa6601f9667a769d81c26592cd0b360d97f2ff6 /drivers/staging/dgap
parent60aff4ffba3336cd97789b60f086d47b1932147b (diff)
staging: dgap: fix possible NULL dereference
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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/dgap')
-rw-r--r--drivers/staging/dgap/dgap.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 9112dd2bf4d7..20ba258ffbdb 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))