mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Norbert Manthey <nmanthey@amazon.de>
To: Norbert Manthey <nmanthey@amazon.de>, <linux-kernel@vger.kernel.org>
Cc: David Woodhouse <dwmw@amazon.co.uk>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>, <x86@kernel.org>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Mike Rapoport" <rppt@linux.vnet.ibm.com>,
	Baoquan He <bhe@redhat.com>, "Nicolai Stange" <nstange@suse.de>,
	Jan Beulich <JBeulich@suse.com>,
	Jan Kiszka <jan.kiszka@siemens.com>
Subject: [PATCH] io_apic: initialize irq with -EINVAL
Date: Wed, 28 Nov 2018 12:09:51 +0100	[thread overview]
Message-ID: <1543403393-6004-1-git-send-email-nmanthey@amazon.de> (raw)

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 <nmanthey@amazon.de>
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
---
 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



             reply	other threads:[~2018-11-28 11:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-28 11:09 Norbert Manthey [this message]
2018-11-30 12:14 ` Thomas Gleixner
2018-11-30 19:17   ` Norbert Manthey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1543403393-6004-1-git-send-email-nmanthey@amazon.de \
    --to=nmanthey@amazon.de \
    --cc=JBeulich@suse.com \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=bp@alien8.de \
    --cc=dwmw@amazon.co.uk \
    --cc=ebiederm@xmission.com \
    --cc=hpa@zytor.com \
    --cc=jan.kiszka@siemens.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=nstange@suse.de \
    --cc=rppt@linux.vnet.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®