[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20190827160612.11114-1-efremov@linux.com>
Date: Tue, 27 Aug 2019 19:06:12 +0300
From: Denis Efremov <efremov@...ux.com>
To: linux-kernel@...r.kernel.org
Cc: Denis Efremov <efremov@...ux.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Leonardo Bras <leobras.c@...il.com>,
Allison Randal <allison@...utok.net>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
Thomas Gleixner <tglx@...utronix.de>
Subject: [PATCH] ASN.1: Fix NULL check after strdup call
strdup function returns a pointer to the newly allocated string,
or a NULL if an error occurred. Thus, grammar_name should be checked
right after strdup call. p variable can't be NULL in this context.
This follows from p check before the strdup call.
Signed-off-by: Denis Efremov <efremov@...ux.com>
---
scripts/asn1_compiler.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/asn1_compiler.c b/scripts/asn1_compiler.c
index adabd4145264..985fb81cae79 100644
--- a/scripts/asn1_compiler.c
+++ b/scripts/asn1_compiler.c
@@ -625,7 +625,7 @@ int main(int argc, char **argv)
p = strrchr(argv[1], '/');
p = p ? p + 1 : argv[1];
grammar_name = strdup(p);
- if (!p) {
+ if (!grammar_name) {
perror(NULL);
exit(1);
}
--
2.21.0
Powered by blists - more mailing lists