Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933316AbcK2KkZ (ORCPT ); Tue, 29 Nov 2016 05:40:25 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:37827 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932645AbcK2KkJ (ORCPT ); Tue, 29 Nov 2016 05:40:09 -0500 X-AuditID: cbfee61b-f796f6d000004092-75-583d5af23877 From: Maninder Singh To: robh+dt@kernel.org, rowand.list@gmail.com Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, v.narang@samsung.com, pankaj.m@samsung.com, ajeet.y@samsung.com, Maninder Singh Subject: [PATCH 1/1] scripts: Fixing NULL pointer dereference when pos->file is NULL Date: Tue, 29 Nov 2016 16:04:59 +0530 Message-id: <1480415699-35335-1-git-send-email-maninder1.s@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrCLMWRmVeSWpSXmKPExsVy+t9jQd3PUbYRBg9Ps1q8eDWBxWL+kXOs Fpd3zWGzODy/jcXi3putTBate4+wW3w5mmJx6ORcRgcOj52z7rJ7bFrVyebRt2UVo8fnTXIB LFFuNhmpiSmpRQqpecn5KZl56bZKoSFuuhZKCnmJuam2ShG6viFBSgpliTmlQJ6RARpwcA5w D1bSt0twy9jV95+1YDN7xcUXe9gbGH+zdjFyckgImEis65nDAmGLSVy4t56ti5GLQ0hgFqPE 43tfWSCcn4wS/w7eBetgE9CTWLVrD1iHiICuxMFJ78BsZoHVjBJzfgmC2MICYRJnpnwCi7MI qErs2bKFDcTmFXCXuH+6gxlim5zEyWOTWScwci9gZFjFKJFakFxQnJSea5SXWq5XnJhbXJqX rpecn7uJERyiz6R3MB7e5X6IUYCDUYmHV8PYNkKINbGsuDL3EKMEB7OSCG9sJFCINyWxsiq1 KD++qDQntfgQoynQAROZpUST84Hxk1cSb2hibmJubGBhbmlpYqQkzts4+1m4kEB6Yklqdmpq QWoRTB8TB6dUA6OD6BzGwqLPDiz8XzLXGwjUrD4V+vqc0Mn0n3wLuLZt4vyV/FYyWeKwmmdY tNa35WGsM2/Jv8ybJbYhMpJ5j3uv21xPvcrd2SmrUlSb3pRfdiwK25XaUOT86Ok2lu693Dum LZh21sv9vEbJe+4DsTOO+r3d7Reitbms4+rBb/omPqdXX7RS3aTEUpyRaKjFXFScCACnj5CQ ZwIAAA== X-MTR: 20000000000000000@CPGS Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 916 Lines: 29 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); } -- 1.9.1