lkml.org 
[lkml]   [2016]   [Nov]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 1/1] scripts: Fixing NULL pointer dereference when pos->file is NULL
Date
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

\
 
 \ /
  Last update: 2016-11-29 12:16    [W:0.179 / U:0.420 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site