MISRA R16.6 states that "Every switch statement shall have at least two
switch-clauses". There are only 3 violations left on x86 (zero on ARM).
One of them is only a violation depending on the kconfig configuration.
So deviate it instead with a SAF comment.
Two of them are deliberate to enable future additions. Deviate them as
such.
Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
Reviewed-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
},
{
"id": "SAF-11-safe",
+ "analyser": {
+ "eclair": "MC3A2.R16.6"
+ },
+ "name": "Rule 16.6: single clause due to kconfig",
+ "text": "A switch statement with a single switch clause because other switch clauses are disabled in a given kconfig is safe."
+ },
+ {
+ "id": "SAF-12-safe",
+ "analyser": {
+ "eclair": "MC3A2.R16.6"
+ },
+ "name": "Rule 16.6: single clause due to future expansion",
+ "text": "A switch statement with a single switch clause to purposely enable future additions of new cases is safe."
+ },
+ {
+ "id": "SAF-13-safe",
"analyser": {},
"name": "Sentinel",
"text": "Next ID to be used"
{
ASSERT(v == current || !vcpu_runnable(v));
+ /* SAF-12-safe */
switch ( reg )
{
default:
{
ASSERT(v == current || !vcpu_runnable(v));
+ /* SAF-12-safe */
switch ( reg )
{
default:
static unsigned long get_shstk_bottom(unsigned long sp)
{
+ /* SAF-11-safe */
switch ( get_stack_page(sp) )
{
#ifdef CONFIG_XEN_SHSTK