linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] scripts: Fixing NULL pointer dereference when pos->file is NULL
@ 2016-11-29 10:34 Maninder Singh
  2016-11-29 11:15 ` Arnd Bergmann
  2016-11-29 19:08 ` Frank Rowand
  0 siblings, 2 replies; 3+ messages in thread
From: Maninder Singh @ 2016-11-29 10:34 UTC (permalink / raw)
  To: robh+dt, rowand.list
  Cc: devicetree, linux-kernel, v.narang, pankaj.m, ajeet.y, Maninder Singh

This patch fixes NULL pointer dereference when pos->file is NULL.

caught with static analysis tool.
Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Signed-off-by: Vaneet Narang <v.narang@samsung.com>
---
 scripts/dtc/srcpos.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/scripts/dtc/srcpos.c b/scripts/dtc/srcpos.c
index f534c22..360fd14 100644
--- a/scripts/dtc/srcpos.c
+++ b/scripts/dtc/srcpos.c
@@ -252,12 +252,11 @@ struct srcpos *
 srcpos_dump(struct srcpos *pos)
 {
 	printf("file        : \"%s\"\n",
-	       pos->file ? (char *) pos->file : "<no file>");
+	       pos->file ?  pos->file->name : "<no file>");
 	printf("first_line  : %d\n", pos->first_line);
 	printf("first_column: %d\n", pos->first_column);
 	printf("last_line   : %d\n", pos->last_line);
 	printf("last_column : %d\n", pos->last_column);
-	printf("file        : %s\n", pos->file->name);
 }
 
 
-- 
1.9.1

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

end of thread, other threads:[~2016-11-29 19:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-29 10:34 [PATCH 1/1] scripts: Fixing NULL pointer dereference when pos->file is NULL Maninder Singh
2016-11-29 11:15 ` Arnd Bergmann
2016-11-29 19:08 ` Frank Rowand

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