From 768d772e0968110f05298056b4354f5a015aad58 Mon Sep 17 00:00:00 2001 From: Nicola Vetrini Date: Wed, 30 Sep 2026 08:50:36 +0200 Subject: [PATCH] eclair: restrict scoping of guest copy deviation MISRA C Rule 11.8 violations The file scoping restrictions were spelled out in the documentation comment, but not enforced by the configuration. Remove duplicated file tag asm_offsets while at it. No functional change. Suggested-by: Jan Beulich Signed-off-by: Nicola Vetrini Acked-by: Jan Beulich --- automation/eclair_analysis/ECLAIR/deviations.ecl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl index 400413f8f5..6cdb10a129 100644 --- a/automation/eclair_analysis/ECLAIR/deviations.ecl +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl @@ -229,7 +229,6 @@ const-qualified." -doc_end -doc_begin="The definitions present in this file are meant to generate definitions for asm modules, and are not called by C code. Therefore the absence of prior declarations is safe." --file_tag+={asm_offsets, "^xen/arch/(arm|x86)/(arm32|arm64|x86_64)/asm-offsets\\.c$"} -config=MC3A2.R8.4,reports+={safe, "first_area(any_loc(file(asm_offsets)))"} -doc_end @@ -440,13 +439,15 @@ Fixing this violation would require to increase code complexity and lower readab -doc_begin="Function copy_guest() in xen/arch/arm/guestcopy.c is a double-use function, where the parameter needs to not be const because it can be set for write or not" --config=MC3A2.R11.8,reports+={safe,"any_area(any_loc(text(^.*copy_guest.*COPY_to_guest doesn't modify.*$)))"} +-file_tag+={arm_guestcopy, "^xen/arch/arm/guestcopy\\.c$"} +-config=MC3A2.R11.8,reports+={safe,"any_area(any_loc(file(arm_guestcopy)&&text(^.*copy_guest.*COPY_to_guest doesn't modify.*$)))"} -doc_end -doc_begin="Function __hvm_copy in xen/arch/x86/hvm/hvm.c is a double-use function, where the parameter needs to not be const because it can be set for write or not" --config=MC3A2.R11.8,reports+={safe,"any_area(any_loc(text(^.*__hvm_copy.*HVMCOPY_to_guest doesn't modify.*$)))"} +-file_tag+={hvm_guestcopy, "^xen/arch/x86/hvm/hvm\\.c$"} +-config=MC3A2.R11.8,reports+={safe,"any_area(any_loc(file(hvm_guestcopy)&&text(^.*__hvm_copy.*HVMCOPY_to_guest doesn't modify.*$)))"} -doc_end -doc_begin="This construct is used to check if the type is scalar, and for this purpose the use of 0 as a null pointer constant is deliberate."