mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
MISRA C Rule 18.2 states: "Subtraction between pointers shall only be applied to pointers that address elements of the same array". Subtractions between pointer where at least one symbol is a symbol defined by the linker are safe and thus deviated, because the compiler cannot exploit the undefined behaviour that would arise from violating the rules in this case. To create an ECLAIR configuration that contains the list of linker-defined symbols, the script "linker-symbols.sh" is used after a build of xen (without static analysis) is performed. The generated file "linker_symbols.ecl" is then used as part of the static analysis configuration. Additional changes to the ECLAIR integration are: - perform a build of xen without static analysis during prepare.sh - run the scripts to generated ECL configuration during the prepare.sh, rather than analysis.sh - export ECLAIR_PROJECT_ROOT earlier, to allow such generation Additionally, the macro page_to_mfn performs a subtraction that is safe, so its uses are deviated. No functional changes. Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com> Acked-by: Stefano Stabellini <sstabellini@kernel.org>
40 lines
1.3 KiB
Bash
Executable File
40 lines
1.3 KiB
Bash
Executable File
#!/bin/sh -eu
|
|
|
|
ECLAIR_ANALYSIS_DIR=automation/eclair_analysis
|
|
ECLAIR_DIR="${ECLAIR_ANALYSIS_DIR}/ECLAIR"
|
|
ECLAIR_OUTPUT_DIR=$(realpath "${ECLAIR_OUTPUT_DIR}")
|
|
# All paths mentioned in ECLAIR reports that are below this directory
|
|
# will be presented as relative to ECLAIR_PROJECT_ROOT.
|
|
export ECLAIR_PROJECT_ROOT="${PWD}"
|
|
|
|
"${ECLAIR_ANALYSIS_DIR}/prepare.sh" "${VARIANT}"
|
|
|
|
ex=0
|
|
"${ECLAIR_DIR}/analyze.sh" "${VARIANT}" "${RULESET}" || ex=$?
|
|
"${ECLAIR_DIR}/action_log.sh" ANALYSIS_LOG \
|
|
"ECLAIR analysis log" \
|
|
"${ECLAIR_OUTPUT_DIR}/ANALYSIS.log" \
|
|
"${ex}"
|
|
"${ECLAIR_DIR}/action_log.sh" REPORT_LOG \
|
|
"ECLAIR report log" \
|
|
"${ECLAIR_OUTPUT_DIR}/REPORT.log" \
|
|
"${ex}"
|
|
[ "${ex}" = 0 ] || exit "${ex}"
|
|
|
|
# Fail in case of new reports for clean guidelines
|
|
"${ECLAIR_DIR}/action_check_clean_regressions.sh" "${ECLAIR_OUTPUT_DIR}" || ex=$?
|
|
|
|
case "${CI_PIPELINE_SOURCE}" in
|
|
merge_request_event)
|
|
"${ECLAIR_DIR}/action_pull_request.sh" "${WTOKEN}" "${ECLAIR_OUTPUT_DIR}"
|
|
;;
|
|
push | pipeline | web | schedule)
|
|
"${ECLAIR_DIR}/action_push.sh" "${WTOKEN}" "${ECLAIR_OUTPUT_DIR}"
|
|
;;
|
|
*)
|
|
echo "Unexpected event ${CI_PIPELINE_SOURCE}" >&2
|
|
ex=1
|
|
;;
|
|
esac
|
|
[ "${ex}" = 0 ] || exit "${ex}"
|