Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754121AbdDJRrZ (ORCPT ); Mon, 10 Apr 2017 13:47:25 -0400 Received: from mail1.bemta12.messagelabs.com ([216.82.251.8]:44533 "EHLO mail1.bemta12.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753986AbdDJRrV (ORCPT ); Mon, 10 Apr 2017 13:47:21 -0400 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrEIsWRWlGSWpSXmKPExsVy+LrFKl2ho68 jDPqu81j8nXSM3WLH0s1MFq/OrGWzuLxrDpvF2XnH2SwOLG1nsXjz+wW7xcEPT1gtWp7OYLT4 v+UzmwOXR//sKWwea+atYfT4/WsSo0f/us+sHptWdbJ5fN4kF8AWxZqZl5RfkcCacWfydvaC+ ewVP5adY2tgnMDWxcjFISSwjFGiYeda9i5GTg4RAV+JM392s4AkmAWuM0lcvLiZGSTBJmAicf P+ORYQW1jAQuLgmRVsIDavgLPEma9HgeIcHCwCqhKbnqqDhEUFEiQu/pnCClEiKHFy5hOwVmY BfYmmrXOYIWx5ie1vIWwhAW2J9xsXg9VLCChITJ3cyjyBkXcWkvZZSNpnIWlfwMi8ilG9OLWo LLVI10gvqSgzPaMkNzEzR9fQ0EgvN7W4ODE9NScxqVgvOT93EyMwvBmAYAdj2xznQ4ySHExKo rwBM19HCPEl5adUZiQWZ8QXleakFh9ilOHgUJLglToClBMsSk1PrUjLzAFGGkxagoNHSYS37D BQmre4IDG3ODMdInWKUZdjzr2v75mEWPLy81KlxHl3gxQJgBRllObBjYBF/SVGWSlhXkago4R 4ClKLcjNLUOVfMYpzMCoJ8/KBXMKTmVcCt+kV0BFMQEec2fUS5IiSRISUVAOj15+Ec4IrV965 yCr5XHwCY2WW83HWyR4eM8/M2+C+7dhs6bAUk953Nju4lSIKFTKmy2/l+Vh6Tc7ksL38nmD7d 2vL7tdHbN2t38ITXGE840uSOtsqDXPt7zuSP3MtPqQ3K5ft1t67t1MFjp/ofnhgmZDJ1uOff+ zyXOWyo6Rc+Nll56xNFouylFiKMxINtZiLihMB/Vnu9vUCAAA= X-Env-Sender: Marc_Gonzalez@sigmadesigns.com X-Msg-Ref: server-14.tower-219.messagelabs.com!1491846416!148342316!1 X-Originating-IP: [195.215.56.170] X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked To: Bjorn Helgaas , linux-pci CC: Robin Murphy , Lorenzo Pieralisi , Liviu Dudau , David Laight , Arnd Bergmann , Thibaud Cornic , Mason , Yinghai Lu , LKML From: Marc Gonzalez Subject: [PATCH] PCI: Improve __pci_read_base robustness Message-ID: <1c0ad12a-9bfc-2a76-ee76-6ab403f912d3@sigmadesigns.com> Date: Mon, 10 Apr 2017 19:46:54 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0 SeaMonkey/2.48 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: 7bit X-Originating-IP: [172.27.0.114] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 927 Lines: 27 Local variables 'l' and 'sz' are uninitialized. Normally, they would be initialized by pci_read_config_dword() but when an error occurs, some drivers immediately return an error code, which leaves the argument uninitialized. Provide a safe initial value to make the code more robust. Signed-off-by: Marc Gonzalez --- drivers/pci/probe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index d266d800f246..6fb929bd7040 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -175,7 +175,7 @@ static inline unsigned long decode_bar(struct pci_dev *dev, u32 bar) int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, struct resource *res, unsigned int pos) { - u32 l, sz, mask; + u32 l = 0, sz = 0, mask; u64 l64, sz64, mask64; u16 orig_cmd; struct pci_bus_region region, inverted_region; -- 2.11.0