diff options
Diffstat (limited to 'recipes-extended/xen/files/0001-arm-silence-gcc14-warning-error-on-irq-bounds-check.patch')
-rw-r--r-- | recipes-extended/xen/files/0001-arm-silence-gcc14-warning-error-on-irq-bounds-check.patch | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/recipes-extended/xen/files/0001-arm-silence-gcc14-warning-error-on-irq-bounds-check.patch b/recipes-extended/xen/files/0001-arm-silence-gcc14-warning-error-on-irq-bounds-check.patch new file mode 100644 index 00000000..637d6fe5 --- /dev/null +++ b/recipes-extended/xen/files/0001-arm-silence-gcc14-warning-error-on-irq-bounds-check.patch | |||
@@ -0,0 +1,65 @@ | |||
1 | From 2258853a19b2d0b1fafd901cddf69f730c38d450 Mon Sep 17 00:00:00 2001 | ||
2 | From: Bruce Ashfield <bruce.ashfield@gmail.com> | ||
3 | Date: Fri, 31 May 2024 14:50:33 +0000 | ||
4 | Subject: [PATCH] arm: silence gcc14 warning (error) on irq bounds check | ||
5 | |||
6 | While we wait for upstream to update to gcc14, we add a quick | ||
7 | check to avoid gcc14 not being able to confirm that IRQ is | ||
8 | greater than 0 and hence throws a warning, which leads to an | ||
9 | error. | ||
10 | |||
11 | | In function '__irq_to_desc', | ||
12 | | inlined from 'route_irq_to_guest' at arch/arm/irq.c:467:12: | ||
13 | | arch/arm/irq.c:65:16: error: array subscript -2 is below array bounds of 'irq_desc_t[32]' {aka 'struct irq_desc[32]'} [-Werror=array-bounds=] | ||
14 | | 65 | return &this_cpu(local_irq_desc)[irq]; | ||
15 | | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
16 | |||
17 | Upstream-Status: Pending [the xen folks understand the code and the right fix .. I don't] | ||
18 | |||
19 | Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> | ||
20 | --- | ||
21 | xen/arch/arm/irq.c | 19 ++++++++++++------- | ||
22 | 1 file changed, 12 insertions(+), 7 deletions(-) | ||
23 | |||
24 | Index: git/xen/arch/arm/irq.c | ||
25 | =================================================================== | ||
26 | --- git.orig/xen/arch/arm/irq.c | ||
27 | +++ git/xen/arch/arm/irq.c | ||
28 | @@ -48,8 +48,13 @@ void irq_end_none(struct irq_desc *irq) | ||
29 | static irq_desc_t irq_desc[NR_IRQS]; | ||
30 | static DEFINE_PER_CPU(irq_desc_t[NR_LOCAL_IRQS], local_irq_desc); | ||
31 | |||
32 | + | ||
33 | struct irq_desc *__irq_to_desc(int irq) | ||
34 | { | ||
35 | + /* silence gcc14 warning */ | ||
36 | + if ( irq < 0 ) | ||
37 | + return &this_cpu(local_irq_desc)[0]; | ||
38 | + | ||
39 | if ( irq < NR_LOCAL_IRQS ) | ||
40 | return &this_cpu(local_irq_desc)[irq]; | ||
41 | |||
42 | @@ -722,16 +727,16 @@ int platform_get_irq(const struct dt_dev | ||
43 | |||
44 | int platform_get_irq_byname(const struct dt_device_node *np, const char *name) | ||
45 | { | ||
46 | - int index; | ||
47 | + int index; | ||
48 | |||
49 | - if ( unlikely(!name) ) | ||
50 | - return -EINVAL; | ||
51 | + if ( unlikely(!name) ) | ||
52 | + return -EINVAL; | ||
53 | |||
54 | - index = dt_property_match_string(np, "interrupt-names", name); | ||
55 | - if ( index < 0 ) | ||
56 | - return index; | ||
57 | + index = dt_property_match_string(np, "interrupt-names", name); | ||
58 | + if ( index < 0 ) | ||
59 | + return index; | ||
60 | |||
61 | - return platform_get_irq(np, index); | ||
62 | + return platform_get_irq(np, index); | ||
63 | } | ||
64 | |||
65 | /* | ||