On 14.12.2023 13:07, Simone Ballarin wrote: > --- a/docs/misra/safe.json > +++ b/docs/misra/safe.json > @@ -28,6 +28,14 @@ > }, > { > "id": "SAF-3-safe", > + "analyser": { > + "eclair": "MC3R1.R11.8" > + }, > + "name": "MC3R1.R11.8: removal of const qualifier to comply with > function signature", > + "text": "It is safe to cast away const qualifiers to comply with > function signature if the function does not modify the pointee."
I'm not happy with this description, as it invites for all sorts of abuse. Yet I'm also puzzled that ... > --- a/xen/arch/x86/hvm/hvm.c > +++ b/xen/arch/x86/hvm/hvm.c > @@ -3413,6 +3413,7 @@ static enum hvm_translation_result __hvm_copy( > enum hvm_translation_result hvm_copy_to_guest_phys( > paddr_t paddr, const void *buf, unsigned int size, struct vcpu *v) > { > + /* SAF-3-safe */ > return __hvm_copy((void *)buf /* HVMCOPY_to_guest doesn't modify */, > paddr, size, v, > HVMCOPY_to_guest | HVMCOPY_phys, 0, NULL); ... this is the only place you then use it. Afaict some of Arm's copy_guest() callers ought to have a similar issue. If so, an enlarged patch should be discussed with a larger audience, to see how we collectively think we want to put this specific kind of deviation. Jan