... | ... | ||
---|---|---|---|
5 | rules.rst. Add them now. | 5 | rules.rst. Add them now. |
6 | 6 | ||
7 | Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com> | 7 | Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com> |
8 | Acked-by: Jan Beulich <jbeulich@suse.com> | 8 | Acked-by: Jan Beulich <jbeulich@suse.com> |
9 | --- | 9 | --- |
10 | Note that safe.json and the codebase are not yet updated with an | 10 | Nicola, does this work with ECLAIR? |
11 | appropriate tag for BUG, panic and friends. | ||
12 | 11 | ||
13 | v2: | 12 | I am referring to the locations of the SAF-2-safe tag on top of |
14 | - fix typo in commit message | 13 | call_psci_system_off, BUG, etc. |
15 | - use "only referenced from assembly" | 14 | |
16 | - use "Deliberate unreachability caused by" | 15 | Changes in v3: |
17 | - add "See safe.json" | 16 | - added SAF-2-safe to safe.json |
18 | - add acked-by (although I also added "See safe.json") | 17 | - added a few SAF-2-safe examples |
19 | --- | 18 | --- |
20 | docs/misra/rules.rst | 13 ++++++++++++- | 19 | docs/misra/rules.rst | 13 ++++++++++++- |
21 | 1 file changed, 12 insertions(+), 1 deletion(-) | 20 | docs/misra/safe.json | 8 ++++++++ |
21 | xen/arch/arm/psci.c | 1 + | ||
22 | xen/arch/x86/shutdown.c | 1 + | ||
23 | xen/include/xen/bug.h | 2 ++ | ||
24 | 5 files changed, 24 insertions(+), 1 deletion(-) | ||
22 | 25 | ||
23 | diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst | 26 | diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst |
24 | index XXXXXXX..XXXXXXX 100644 | 27 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/docs/misra/rules.rst | 28 | --- a/docs/misra/rules.rst |
26 | +++ b/docs/misra/rules.rst | 29 | +++ b/docs/misra/rules.rst |
... | ... | ||
42 | + - Declarations without initializer are safe, as they are not | 45 | + - Declarations without initializer are safe, as they are not |
43 | + executed | 46 | + executed |
44 | 47 | ||
45 | * - `Rule 2.6 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_02_06.c>`_ | 48 | * - `Rule 2.6 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_02_06.c>`_ |
46 | - Advisory | 49 | - Advisory |
50 | diff --git a/docs/misra/safe.json b/docs/misra/safe.json | ||
51 | index XXXXXXX..XXXXXXX 100644 | ||
52 | --- a/docs/misra/safe.json | ||
53 | +++ b/docs/misra/safe.json | ||
54 | @@ -XXX,XX +XXX,XX @@ | ||
55 | }, | ||
56 | { | ||
57 | "id": "SAF-2-safe", | ||
58 | + "analyser": { | ||
59 | + "eclair": "MC3R1.R2.1" | ||
60 | + }, | ||
61 | + "name": "Rule 2.1: deliberate unreachability", | ||
62 | + "text": "Macro or function designed to be unreachable." | ||
63 | + }, | ||
64 | + { | ||
65 | + "id": "SAF-3-safe", | ||
66 | "analyser": {}, | ||
67 | "name": "Sentinel", | ||
68 | "text": "Next ID to be used" | ||
69 | diff --git a/xen/arch/arm/psci.c b/xen/arch/arm/psci.c | ||
70 | index XXXXXXX..XXXXXXX 100644 | ||
71 | --- a/xen/arch/arm/psci.c | ||
72 | +++ b/xen/arch/arm/psci.c | ||
73 | @@ -XXX,XX +XXX,XX @@ void call_psci_cpu_off(void) | ||
74 | } | ||
75 | } | ||
76 | |||
77 | +/* SAF-2-safe */ | ||
78 | void call_psci_system_off(void) | ||
79 | { | ||
80 | if ( psci_ver > PSCI_VERSION(0, 1) ) | ||
81 | diff --git a/xen/arch/x86/shutdown.c b/xen/arch/x86/shutdown.c | ||
82 | index XXXXXXX..XXXXXXX 100644 | ||
83 | --- a/xen/arch/x86/shutdown.c | ||
84 | +++ b/xen/arch/x86/shutdown.c | ||
85 | @@ -XXX,XX +XXX,XX @@ static inline void kb_wait(void) | ||
86 | break; | ||
87 | } | ||
88 | |||
89 | +/* SAF-2-safe */ | ||
90 | static void noreturn cf_check __machine_halt(void *unused) | ||
91 | { | ||
92 | local_irq_disable(); | ||
93 | diff --git a/xen/include/xen/bug.h b/xen/include/xen/bug.h | ||
94 | index XXXXXXX..XXXXXXX 100644 | ||
95 | --- a/xen/include/xen/bug.h | ||
96 | +++ b/xen/include/xen/bug.h | ||
97 | @@ -XXX,XX +XXX,XX @@ struct bug_frame { | ||
98 | #endif | ||
99 | |||
100 | #ifndef BUG | ||
101 | +/* SAF-2-safe */ | ||
102 | #define BUG() do { \ | ||
103 | BUG_FRAME(BUGFRAME_bug, __LINE__, __FILE__, 0, NULL); \ | ||
104 | unreachable(); \ | ||
105 | @@ -XXX,XX +XXX,XX @@ struct bug_frame { | ||
106 | #endif | ||
107 | |||
108 | #ifndef assert_failed | ||
109 | +/* SAF-2-safe */ | ||
110 | #define assert_failed(msg) do { \ | ||
111 | BUG_FRAME(BUGFRAME_assert, __LINE__, __FILE__, 1, msg); \ | ||
112 | unreachable(); \ | ||
47 | -- | 113 | -- |
48 | 2.25.1 | 114 | 2.25.1 | diff view generated by jsdifflib |