Hi Jan, Jan Beulich <[email protected]> writes:
> On 22.09.2026 03:45, Volodymyr Babchuk wrote: >> Jan Beulich <[email protected]> writes: >>> Not doing so results in a number of Misra rule 11.8 (casting away of >>> const-ness) violations. We need to allow kexec to use pointer to non- >>> const though, so provide a means to override the default. >>> >>> For ELFNOTE_NEXT() we can do better and simply re-apply the type of the >>> incoming pointer. >>> >>> Signed-off-by: Jan Beulich <[email protected]> >>> >>> --- a/xen/common/kexec.c >>> +++ b/xen/common/kexec.c >>> @@ -6,6 +6,9 @@ >>> * - Magnus Damm <[email protected]> >>> */ >>> >>> +/* We're producing ELF notes here. */ >>> +#define ELFNOTE_CONST >> >> Frankly, it feels backwards. When reading this line of code I am >> assuming that you are adding constness to ELF notes because you are >> defining ELFNOTE_CONST. And I had to check the elf.h to understand that >> you are doing exactly opposite. I am pretty sure that other people will >> confused by this as well. > > Well, that's certainly possible. Yet then you or them are asked to make > an alternative suggestion. An option I could think of would be to merely > rename what is ELFNOTE_CONST right now, to no longer have the word > "CONST" in it. ELFNOTE_MODIFIER maybe, albeit that reads a little clumsy > to me. Taking into account that we need 'const' to be enabled by default, maybe something like that? #ifndef ELFNOTE_NO_CONST #define __ELFNOTE_CONST const #else #define __ELFNOTE_CONST #endif ? And then use #define ELFNOTE_NO_CONST in this hunk -- WBR, Volodymyr
