Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1006831imu; Wed, 28 Nov 2018 03:11:35 -0800 (PST) X-Google-Smtp-Source: AFSGD/VYpmYxm/w1Y5r1C51aXuu2bFqpCE6FOdcQbGl3xrTxJ+3xK4BNb0rwSWNNj8mKDi2qCSaO X-Received: by 2002:a17:902:780a:: with SMTP id p10mr37438622pll.54.1543403495029; Wed, 28 Nov 2018 03:11:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543403495; cv=none; d=google.com; s=arc-20160816; b=Zbksk8TjmqXgBq1RwLqS7HdaQ3xvqoOrsfarXRpeu2U9oburfdJs9MvxegeCMnV99m 0uJZmLc9xfu9O7t67FY1J/FcG0YOJ+ycz8fXQ1qCT+KvKWIJUeL0N2o7UtHk3kObkF+K n6VHWBlO9z1GIUUw8vNpiGSpSfyHuNTau6Zx8NveD3hx8JtY1lR0H5frw/gMNQlYeMle 2DIFNUAPoz/RJ7Bg1DTG5X0N7+6vcK7Foz0A/iqTYsIhUDc+L3hBpw+b5wx+RF6nkWzA 4MLIl3PRdDGCvM7Ve7BVd9roex9/urLYNP5CgvPADKe3Cmhp8nLwWGvmT6PUkn1M4t6v rGAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=Ri20arndQNTFuV6R+3SYIneiawmHlvXWpUTQo19+8+c=; b=HWgLdjv4L4+wHyOXURnZe0N8Ut5tMXHu0cs+HHyg3fpZt39GiSkdqRbXBdpXqDzixe wUbI3rm7UMBl1/fZZqorgSA3ENnj/sj5IU0cUP0rEd5bbsN9RavKWG86DDa521U4Uukb 9BbSWBnTpx7SuMXBcjq4SHOZ5lj/NVJPBn2YiC5r85hcTC9OmdE/ViHZ8rBwY1R1lmWO UXFTdVOOWZaX1ThDUm6X+NkXe0RHZbApCqDxf6BYZuJ72jMxtl1XWz4gncWVrbd8eMJm 5+T2weB1VCORclKpKmVPe23R+EnEhsPBoOvb7/ruBjfuwk73cf9+YxNpsJdmdCBW5h3m ZZ1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=OnMZjFOp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h32si7114757pgh.276.2018.11.28.03.11.18; Wed, 28 Nov 2018 03:11:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=OnMZjFOp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728049AbeK1WLw (ORCPT + 99 others); Wed, 28 Nov 2018 17:11:52 -0500 Received: from smtp-fw-6001.amazon.com ([52.95.48.154]:58685 "EHLO smtp-fw-6001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727997AbeK1WLw (ORCPT ); Wed, 28 Nov 2018 17:11:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1543403435; x=1574939435; h=from:to:cc:subject:date:message-id:mime-version; bh=Ri20arndQNTFuV6R+3SYIneiawmHlvXWpUTQo19+8+c=; b=OnMZjFOp/h+tdqoc+yccMbrCXWMLa5RP2rfQgrfR61HG26g3eOqS81vH ITUoUoNeYEPNlK6b7Wv7Tm5uHPaSzqeftAejtHIGMui2DeFxeRgivMH5t saJ0eIZOnIn5qSMHJ/PXo09TJ27KpWwdqW98IrPqDSSYtgJMkz5E2dMYA k=; X-IronPort-AV: E=Sophos;i="5.56,253,1539648000"; d="scan'208";a="369985763" Received: from iad6-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-1a-af6a10df.us-east-1.amazon.com) ([10.124.125.6]) by smtp-border-fw-out-6001.iad6.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 28 Nov 2018 11:10:34 +0000 Received: from EX13MTAUEB001.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan2.iad.amazon.com [10.40.159.162]) by email-inbound-relay-1a-af6a10df.us-east-1.amazon.com (8.14.7/8.14.7) with ESMTP id wASBAReH088435 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Wed, 28 Nov 2018 11:10:28 GMT Received: from EX13D08UEB003.ant.amazon.com (10.43.60.11) by EX13MTAUEB001.ant.amazon.com (10.43.60.129) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 28 Nov 2018 11:10:27 +0000 Received: from EX13MTAUWB001.ant.amazon.com (10.43.161.207) by EX13D08UEB003.ant.amazon.com (10.43.60.11) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 28 Nov 2018 11:10:27 +0000 Received: from uc1a35a69ae4659.ant.amazon.com (10.95.69.169) by mail-relay.amazon.com (10.43.161.249) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Wed, 28 Nov 2018 11:10:23 +0000 From: Norbert Manthey To: Norbert Manthey , CC: David Woodhouse , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , , "Eric W. Biederman" , Andrew Morton , "Mike Rapoport" , Baoquan He , "Nicolai Stange" , Jan Beulich , Jan Kiszka Subject: [PATCH] io_apic: initialize irq with -EINVAL Date: Wed, 28 Nov 2018 12:09:51 +0100 Message-ID: <1543403393-6004-1-git-send-email-nmanthey@amazon.de> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To catch the case where the uninitialized variable irq might be returned. As the path that might lead to this situation can only occur based on invalid arguments, we initialize this variable with the value -EINVAL, so that callers are notified accordingly, and no uninitialized value is returned. The path that would allow to return an uninitialized value for the variable irq would require legacy IRQs without the ALLOC flag. Signed-off-by: Norbert Manthey Signed-off-by: David Woodhouse --- arch/x86/kernel/apic/io_apic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 2953bbf..219dbc1 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c @@ -1031,7 +1031,7 @@ static int alloc_isa_irq_from_domain(struct irq_domain *domain, static int mp_map_pin_to_irq(u32 gsi, int idx, int ioapic, int pin, unsigned int flags, struct irq_alloc_info *info) { - int irq; + int irq = -EINVAL; bool legacy = false; struct irq_alloc_info tmp; struct mp_chip_data *data; -- 2.7.4 Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrer: Christian Schlaeger, Ralf Herbrich Ust-ID: DE 289 237 879 Eingetragen am Amtsgericht Charlottenburg HRB 149173 B