x86/IRQ: avoid UB (or worse) in trace_irq_mask()
authorJan Beulich <jbeulich@suse.com>
Mon, 13 May 2019 14:41:03 +0000 (16:41 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 13 May 2019 14:41:03 +0000 (16:41 +0200)
commit6fafb8befa99620a2d7323b9eca5c387bad1f59f
tree8cd2ebb8c79ee5127d1d64d03b5157d745f6f7a4
parent396ce9ca0215b494446f740c643e824401fc0843
x86/IRQ: avoid UB (or worse) in trace_irq_mask()

Dynamically allocated CPU mask objects may be smaller than cpumask_t, so
copying has to be restricted to the actual allocation size. This is
particulary important since the function doesn't bail early when tracing
is not active, so even production builds would be affected by potential
misbehavior here.

Take the opportunity and also
- use initializers instead of assignment + memset(),
- constify the cpumask_t input pointer,
- u32 -> uint32_t.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
xen/arch/x86/irq.c