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


Groups > linux.kernel > #1532123 > unrolled thread

[PATCH 1/1] scripts: Fixing NULL pointer dereference when pos->file is NULL

Started byManinder Singh <maninder1.s@samsung.com>
First post2016-11-29 11:50 +0100
Last post2016-11-29 20:10 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/1] scripts: Fixing NULL pointer dereference when pos->file is  NULL Maninder Singh <maninder1.s@samsung.com> - 2016-11-29 11:50 +0100
    Re: [PATCH 1/1] scripts: Fixing NULL pointer dereference when pos->file is NULL Arnd Bergmann <arnd@arndb.de> - 2016-11-29 12:20 +0100
    Re: [PATCH 1/1] scripts: Fixing NULL pointer dereference when  pos->file is NULL Frank Rowand <frowand.list@gmail.com> - 2016-11-29 20:10 +0100

#1532123 — [PATCH 1/1] scripts: Fixing NULL pointer dereference when pos->file is NULL

FromManinder Singh <maninder1.s@samsung.com>
Date2016-11-29 11:50 +0100
Subject[PATCH 1/1] scripts: Fixing NULL pointer dereference when pos->file is NULL
Message-ID<sIO94-7lk-11@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1532141 — Re: [PATCH 1/1] scripts: Fixing NULL pointer dereference when pos->file is NULL

FromArnd Bergmann <arnd@arndb.de>
Date2016-11-29 12:20 +0100
SubjectRe: [PATCH 1/1] scripts: Fixing NULL pointer dereference when pos->file is NULL
Message-ID<sIOC6-7Kl-11@gated-at.bofh.it>
In reply to#1532123
On Tuesday, November 29, 2016 4:04:59 PM CET Maninder Singh wrote:
> 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);
> 

The patch looks right, but the description doesn't seem to
match the bug.

	Arnd

[toc] | [prev] | [next] | [standalone]


#1532681 — Re: [PATCH 1/1] scripts: Fixing NULL pointer dereference when pos->file is NULL

FromFrank Rowand <frowand.list@gmail.com>
Date2016-11-29 20:10 +0100
SubjectRe: [PATCH 1/1] scripts: Fixing NULL pointer dereference when pos->file is NULL
Message-ID<sIVWW-451-15@gated-at.bofh.it>
In reply to#1532123
On 11/29/16 02:34, Maninder Singh wrote:
> 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);
>  }
>  
>  
> 

Hi Maninder,

Please send any patches for dtc to the devicetree-compiler
mail list.  For details, see:

   http://vger.kernel.org/vger-lists.html#devicetree-compiler

-Frank

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web