Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752003AbcK2TJI (ORCPT ); Tue, 29 Nov 2016 14:09:08 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:32798 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753542AbcK2TI7 (ORCPT ); Tue, 29 Nov 2016 14:08:59 -0500 Subject: Re: [PATCH 1/1] scripts: Fixing NULL pointer dereference when pos->file is NULL To: Maninder Singh , robh+dt@kernel.org, frowand.list@gmail.com References: <1480415699-35335-1-git-send-email-maninder1.s@samsung.com> Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, v.narang@samsung.com, pankaj.m@samsung.com, ajeet.y@samsung.com From: Frank Rowand Message-ID: <583DD247.3000506@gmail.com> Date: Tue, 29 Nov 2016 11:08:55 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <1480415699-35335-1-git-send-email-maninder1.s@samsung.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1179 Lines: 38 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 > Signed-off-by: Vaneet Narang > --- > 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 : ""); > + pos->file ? pos->file->name : ""); > 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