Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755204AbcK3Fak (ORCPT ); Wed, 30 Nov 2016 00:30:40 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:56864 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750825AbcK3Faa (ORCPT ); Wed, 30 Nov 2016 00:30:30 -0500 X-AuditID: cbfee61a-f79916d0000062de-ec-583e5ce40358 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, majordomo@vger.kernel.org, Maninder Singh Subject: [PATCH v2] scripts: printing file name correctly Date: Wed, 30 Nov 2016 10:25:34 +0530 Message-id: <1480481734-45286-1-git-send-email-maninder1.s@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOLMWRmVeSWpSXmKPExsVy+t9jAd0nMXYRBlseWlq8eDWBxWL+kXOs Fpd3zWGz+LxJz+Lw/DYWi3tvtjJZtO49wm7x5WiKxaGTcxkdOD12zrrL7rFpVSebR9+WVYwe nzfJBbBEudlkpCampBYppOYl56dk5qXbKoWGuOlaKCnkJeam2ipF6PqGBCkplCXmlAJ5RgZo wME5wD1YSd8uwS3j6I8+loJ2zoo//66yNDAuZO9i5OSQEDCR+DDxBSuELSZx4d56ti5GLg4h gaWMEndvn2aBcH4ySnw8tgysik1AT2LVrj0sILaIgK7EwUnvwGxmgWOMEm3zEkBsYQFLidl3 1zGD2CwCqhLzN2wEsjk4eAXcJZZ8ZYJYJidx8thk1gmM3AsYGVYxSqQWJBcUJ6XnGuallusV J+YWl+al6yXn525iBAfqM6kdjAd3uR9iFOBgVOLhndBnGyHEmlhWXJl7iFGCg1lJhFcrwi5C iDclsbIqtSg/vqg0J7X4EKMp0P6JzFKiyfnAKMoriTc0MTcxNzawMLe0NDFSEudtnP0sXEgg PbEkNTs1tSC1CKaPiYNTqoGxP61QMLP98OYH77lW9lrZdvBPep9QLnbjftWaJhsGwVSFlQqC c9a4zJY7GiTPf9io3TEgYENhxmLxf5vkjzQvTnj5QfldivlC1yc71qZkKvrpO8gKfnrx8LGz 29U7u2ymNUt5Buu+j93as+LEV3G3He1qa/KSF68Wk3nCljdrofKi5N+1Ux8rsRRnJBpqMRcV JwIASXclVmoCAAA= X-MTR: 20000000000000000@CPGS Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1120 Lines: 37 Currently we are printing file name wrongly. pos->file ? (char *) pos->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 Signed-off-by: Vaneet Narang --- 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 : ""); + 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