linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] show-parse: null pointer dereference in do_show_type()
@ 2020-05-11  3:06 Davidson Francis
  2020-05-14 21:14 ` Luc Van Oostenryck
  0 siblings, 1 reply; 2+ messages in thread
From: Davidson Francis @ 2020-05-11  3:06 UTC (permalink / raw)
  To: linux-sparse; +Cc: Davidson Francis

In do_show_type() the first if statement allows passing null
pointers, which can cause a null pointer dereference in some
cases, which I believe is not the desired behavior.

Fix this by changing the first if statement comparison.

Signed-off-by: Davidson Francis <davidsondfgl@gmail.com>
---
 show-parse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/show-parse.c b/show-parse.c
index 3aa06e47..11a487bc 100644
--- a/show-parse.c
+++ b/show-parse.c
@@ -300,7 +300,7 @@ static void do_show_type(struct symbol *sym, struct type_name *name)
 	int fouled = 0;
 
 deeper:
-	if (!sym || (sym->type != SYM_NODE && sym->type != SYM_ARRAY &&
+	if (sym && (sym->type != SYM_NODE && sym->type != SYM_ARRAY &&
 		     sym->type != SYM_BITFIELD)) {
 		const char *s;
 		size_t len;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] show-parse: null pointer dereference in do_show_type()
  2020-05-11  3:06 [PATCH] show-parse: null pointer dereference in do_show_type() Davidson Francis
@ 2020-05-14 21:14 ` Luc Van Oostenryck
  0 siblings, 0 replies; 2+ messages in thread
From: Luc Van Oostenryck @ 2020-05-14 21:14 UTC (permalink / raw)
  To: Davidson Francis; +Cc: linux-sparse

On Mon, May 11, 2020 at 12:06:20AM -0300, Davidson Francis wrote:
> In do_show_type() the first if statement allows passing null
> pointers, which can cause a null pointer dereference in some
> cases, which I believe is not the desired behavior.
> 
> Fix this by changing the first if statement comparison.

Oh yes ...
Applied & pushed. Thanks.

-- Luc 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-14 21:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-11  3:06 [PATCH] show-parse: null pointer dereference in do_show_type() Davidson Francis
2020-05-14 21:14 ` Luc Van Oostenryck

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).