From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757170AbdKOMuZ (ORCPT ); Wed, 15 Nov 2017 07:50:25 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:39290 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932404AbdKOMuM (ORCPT ); Wed, 15 Nov 2017 07:50:12 -0500 From: Robin Murphy To: robh+dt@kernel.org, frowand.list@gmail.com Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] of/pci: Fix theoretical NULL dereference Date: Wed, 15 Nov 2017 12:50:06 +0000 Message-Id: X-Mailer: git-send-email 2.13.4.dirty Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In the (relatively mechanical) process of adapting the RID-mapping code to put the resulting ID in an output argument rather than the funtion return value, we ended up with the debug print using the argument pointer rather than the local value, which potentially defeats the earlier NULL check. Fixes: 987068fcbdb7: "of/irq: Break out msi-map lookup (again)" Reported-by: Dan Carpenter Signed-off-by: Robin Murphy --- drivers/of/of_pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/of/of_pci.c b/drivers/of/of_pci.c index e9ec931f5b9a..a7b1cb6c2f65 100644 --- a/drivers/of/of_pci.c +++ b/drivers/of/of_pci.c @@ -374,7 +374,7 @@ int of_pci_map_rid(struct device_node *np, u32 rid, pr_debug("%pOF: %s, using mask %08x, rid-base: %08x, out-base: %08x, length: %08x, rid: %08x -> %08x\n", np, map_name, map_mask, rid_base, out_base, - rid_len, rid, *id_out); + rid_len, rid, masked_rid - rid_base + out_base); return 0; } -- 2.13.4.dirty