[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] misra: add deviation for MISRA C Rule R11.1.
Rule 11.1 states as following: "Conversions shall not be performed between a pointer to a function and any other type". In "xen/common/bug.c", in order to get additional debug information, pointer "bug_fn_t *fn" in the data section is converted to a function pointer, which is then used to get such information. This specific conversion has been reviewed and found to have no undefined behaviour associated to it, therefore it can be exempted from compliance. Signed-off-by: Alessandro Zucchelli <alessandro.zucchelli@xxxxxxxxxxx> --- As this patch introduces a deviation for service MC3A2.R11.1, it depends on the following patch and shall not be applied prior to its application. https://lore.kernel.org/xen-devel/cf13be4779f15620e94b99b3b91f9cb040319989.1733826952.git.alessandro.zucchelli@xxxxxxxxxxx/T/#u --- docs/misra/safe.json | 8 ++++++++ xen/common/bug.c | 1 + 2 files changed, 9 insertions(+) diff --git a/docs/misra/safe.json b/docs/misra/safe.json index 684346386e..d80fb3a48f 100644 --- a/docs/misra/safe.json +++ b/docs/misra/safe.json @@ -92,6 +92,14 @@ }, { "id": "SAF-11-safe", + "analyser": { + "eclair": "MC3A2.R11.1" + }, + "name": "Rule 11.1: conversion for debugging purposes", + "text": "conversion of selected pointers to function pointers for debugging purposes are safe." + }, + { + "id": "SAF-12-safe", "analyser": {}, "name": "Sentinel", "text": "Next ID to be used" diff --git a/xen/common/bug.c b/xen/common/bug.c index 75cb35fcfa..2d08bb3d41 100644 --- a/xen/common/bug.c +++ b/xen/common/bug.c @@ -44,6 +44,7 @@ int do_bug_frame(const struct cpu_user_regs *regs, unsigned long pc) if ( id == BUGFRAME_run_fn ) { + /* SAF-11-safe conversion for debugging purposes */ bug_fn_t *fn = bug_ptr(bug); fn(regs); -- 2.43.0
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |