Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1532966 > unrolled thread

[PATCH v2] scripts: printing file name correctly

Started byManinder Singh <maninder1.s@samsung.com>
First post2016-11-30 06:40 +0100
Last post2016-11-30 06:40 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] scripts: printing file name correctly Maninder Singh <maninder1.s@samsung.com> - 2016-11-30 06:40 +0100

#1532966 — [PATCH v2] scripts: printing file name correctly

FromManinder Singh <maninder1.s@samsung.com>
Date2016-11-30 06:40 +0100
Subject[PATCH v2] scripts: printing file name correctly
Message-ID<sJ5MB-1Us-19@gated-at.bofh.it>
Currently we are printing file name wrongly.
pos->file ? (char *) pos->file : "<no file>")

It should be pos->file->name, and secondly if we got NULL
file struture,we will anyway derefer it in last printf.

So, Fixing the same.

caught with static analysis tool.
Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Signed-off-by: Vaneet Narang <v.narang@samsung.com>
---
v1 -> v2: changing description of patch.

 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

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web