|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [XEN PATCH] xen/arm: optee: provide an initialization for struct arm_smccc_res
On 20/07/23 17:54, Julien Grall wrote: Hi Nicola, On 20/07/2023 15:29, Nicola Vetrini wrote:The local variables with type 'struct arm_smccc_res' are initialized just after the declaration to avoid any possible read usage prior to any write usage, which would constitute a violation of MISRA C:2012 Rule 9.1. This is already prevented by suitable checks in the code, but the correctness of this approach is difficult to prove and reason about.So I looked at the implementation of arm_smccc_smc(). For arm64, it is (simplified): This is slightly different because of the chained variadic macro expansions of arm_smccc_smc. I could have stated that arm_smccc_smc initializes its args, but because it's variadic I can't narrow it down to a specific index, therefore the property is not correct, because the input arguments are instead expected to be read by the macro. The same reasoning applies for all variadic macros that have some input and output parameters, not just this one. In the end, if these were fixed-argument functions or macros we can aim for that, and that would obsolete this patch. Regards, -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |