]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
x86/apic: Sanitize return value of apic.set_apic_id()
authorThomas Gleixner <tglx@linutronix.de>
Wed, 13 Sep 2017 21:29:17 +0000 (23:29 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Mon, 25 Sep 2017 18:51:48 +0000 (20:51 +0200)
The set_apic_id() callback returns an unsigned long value which is handed
in to apic_write() as the value argument u32.

Adjust the return value so it returns u32 right away.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Juergen Gross <jgross@suse.com>
Tested-by: Yu Chen <yu.c.chen@intel.com>
Acked-by: Juergen Gross <jgross@suse.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Alok Kataria <akataria@vmware.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Rui Zhang <rui.zhang@intel.com>
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Len Brown <lenb@kernel.org>
Link: https://lkml.kernel.org/r/20170913213153.437208268@linutronix.de
arch/x86/include/asm/apic.h
arch/x86/kernel/apic/apic_flat_64.c
arch/x86/kernel/apic/apic_numachip.c
arch/x86/kernel/apic/x2apic.h
arch/x86/kernel/apic/x2apic_phys.c
arch/x86/kernel/apic/x2apic_uv_x.c
arch/x86/xen/apic.c

index 7d247b2d8c54f803b56282a8ff341a3c9ebb6387..86a3a359e603b81b36d7dd27b69843a090da916d 100644 (file)
@@ -305,7 +305,7 @@ struct apic {
 
        unsigned int (*get_apic_id)(unsigned long x);
        /* Can't be NULL on 64-bit */
-       unsigned long (*set_apic_id)(unsigned int id);
+       u32 (*set_apic_id)(unsigned int id);
 
        int (*cpu_mask_to_apicid)(const struct cpumask *cpumask,
                                  struct irq_data *irqdata,
index dedd5a41ba48c8d72b513c033bcf1fffd03deb71..6543648f0b81fe966c294e9b0a8145b95aa6ea2b 100644 (file)
@@ -119,7 +119,7 @@ static unsigned int flat_get_apic_id(unsigned long x)
        return (x >> 24) & 0xFF;
 }
 
-static unsigned long set_apic_id(unsigned int id)
+static u32 set_apic_id(unsigned int id)
 {
        return (id & 0xFF) << 24;
 }
index 2fda912219a6e97144c9f8c89bb191b8f5323d53..d77c8cc4afc268d6c1ec2b1559c90bbf8d46f1dc 100644 (file)
@@ -38,7 +38,7 @@ static unsigned int numachip1_get_apic_id(unsigned long x)
        return id;
 }
 
-static unsigned long numachip1_set_apic_id(unsigned int id)
+static u32 numachip1_set_apic_id(unsigned int id)
 {
        return (id & 0xff) << 24;
 }
@@ -51,7 +51,7 @@ static unsigned int numachip2_get_apic_id(unsigned long x)
        return ((mcfg >> (28 - 8)) & 0xfff00) | (x >> 24);
 }
 
-static unsigned long numachip2_set_apic_id(unsigned int id)
+static u32 numachip2_set_apic_id(unsigned int id)
 {
        return id << 24;
 }
index 4c38c23289486ecc81d89f52ff4e70583bfd235e..b107de381cb51a5b80600016b7c4cafc3f53b1b1 100644 (file)
@@ -4,6 +4,6 @@ int x2apic_apic_id_valid(int apicid);
 int x2apic_apic_id_registered(void);
 void __x2apic_send_IPI_dest(unsigned int apicid, int vector, unsigned int dest);
 unsigned int x2apic_get_apic_id(unsigned long id);
-unsigned long x2apic_set_apic_id(unsigned int id);
+u32 x2apic_set_apic_id(unsigned int id);
 int x2apic_phys_pkg_id(int initial_apicid, int index_msb);
 void x2apic_send_IPI_self(int vector);
index a4f28212dc5d98e89c72955feac0aea2b0b33e69..315c44eda399a2a0460132da1d3461a694d3e2bb 100644 (file)
@@ -121,7 +121,7 @@ unsigned int x2apic_get_apic_id(unsigned long id)
        return id;
 }
 
-unsigned long x2apic_set_apic_id(unsigned int id)
+u32 x2apic_set_apic_id(unsigned int id)
 {
        return id;
 }
index 0d57bb9079c998173f31bc2f4b73032caf23331b..1b23b9e0a8af23429d2fb4c339289c4f878164c2 100644 (file)
@@ -547,7 +547,7 @@ static unsigned int x2apic_get_apic_id(unsigned long x)
        return id;
 }
 
-static unsigned long set_apic_id(unsigned int id)
+static u32 set_apic_id(unsigned int id)
 {
        /* CHECKME: Do we need to mask out the xapic extra bits? */
        return id;
index b5e48da7fbff408e3beb144219d17e95b86cfcb4..652d62458d8dfb84d19aa505bf1af6d7a056111e 100644 (file)
@@ -30,7 +30,7 @@ static unsigned int xen_io_apic_read(unsigned apic, unsigned reg)
        return 0xfd;
 }
 
-static unsigned long xen_set_apic_id(unsigned int x)
+static u32 xen_set_apic_id(unsigned int x)
 {
        WARN_ON(1);
        return x;