* [PATCH] show_parse: avoid null pointer dereference in do_show_type()
@ 2020-01-16 17:48 Oleg Nesterov
2020-01-16 19:26 ` Luc Van Oostenryck
0 siblings, 1 reply; 2+ messages in thread
From: Oleg Nesterov @ 2020-01-16 17:48 UTC (permalink / raw)
To: Luc Van Oostenryck; +Cc: Alexey Gladkov, linux-sparse
do_show_type() checks sym->type inside the "if (!sym || ...)" block.
While at it, remove the trailing whitespaces.
Fixes: 0fe7ebb9 ("show-parse: do not display base type's redundant specifiers")
Reported-by: Alexey Gladkov <gladkov.alexey@gmail.com>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
show-parse.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/show-parse.c b/show-parse.c
index f0ea9ca..044465e 100644
--- a/show-parse.c
+++ b/show-parse.c
@@ -300,12 +300,12 @@ deeper:
if (as)
prepend(name, "%s ", show_as(as));
- if (sym->type == SYM_BASETYPE || sym->type == SYM_ENUM)
+ if (sym && (sym->type == SYM_BASETYPE || sym->type == SYM_ENUM))
mod &= ~MOD_SPECIFIER;
s = modifier_string(mod);
len = strlen(s);
- name->start -= len;
- memcpy(name->start, s, len);
+ name->start -= len;
+ memcpy(name->start, s, len);
mod = 0;
as = NULL;
}
--
2.5.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] show_parse: avoid null pointer dereference in do_show_type()
2020-01-16 17:48 [PATCH] show_parse: avoid null pointer dereference in do_show_type() Oleg Nesterov
@ 2020-01-16 19:26 ` Luc Van Oostenryck
0 siblings, 0 replies; 2+ messages in thread
From: Luc Van Oostenryck @ 2020-01-16 19:26 UTC (permalink / raw)
To: Oleg Nesterov; +Cc: Alexey Gladkov, linux-sparse
On Thu, Jan 16, 2020 at 06:48:38PM +0100, Oleg Nesterov wrote:
> do_show_type() checks sym->type inside the "if (!sym || ...)" block.
>
> While at it, remove the trailing whitespaces.
Thank you! Applied and pushed.
-- Luc
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-01-16 19:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-16 17:48 [PATCH] show_parse: avoid null pointer dereference in do_show_type() Oleg Nesterov
2020-01-16 19:26 ` Luc Van Oostenryck
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.