Re: [PATCH 7/7] gnttab: unreachable code when GNTTAB_MAX_VERSION < 2

Nicola Vetrini <[email protected]> Tue, 28 Jul 2026 17:53:52 +0200
Newsgroups gmane.comp.emulators.xen.devel
Organization BUGSENG s.r.l.
Message-ID <[email protected]>
On 2026-07-28 17:42, Jan Beulich wrote:
> On 28.07.2026 17:40, Nicola Vetrini wrote:
>> On 2026-07-28 15:53, Jan Beulich wrote:
>>> I'm surprised Eclair doesn't spot the large chunks of unreachable 
>>> code
>>> on
>>> Arm, i.e. violations of Misra C:2012 rule 2.1.
>>> 
>>> Signed-off-by: Jan Beulich <[email protected]>
>>> ---
>>> This pretty certainly isn't dealing with everything. For example, 
>>> with
>>> another helper the gt_version field could likely also become
>>> conditional.
>>> With some more effort the nr_status_frames field similarly could 
>>> become
>>> conditional.
>>> 
>> [...]
>> 
>> Hard to judge only looking at the diff. Is this code unreachable in 
>> the
>> arm64-allcode analysis configuration as well?
> 
> Arm uniformly has
> 
> #define GNTTAB_MAX_VERSION 1
> 
> so all gnttab-v2 code is unreachable there, no matter what 
> configuration.
> 
> Jan

I see. Existing deviations may play a role here in excluding caution 
reports that would otherwise be generated, particularly

-config=MC3A2.R2.1,+reports={safe,"first_area(^.*has an 
invariantly.*$)"}

I see only one condition "GNTTAB_MAX_VERSION" is used directly, while 
the others are via "opt_gnttab_max_version" which is why I reasoned 
there might be cautions involved, instead of violations.

-- 
Nicola Vetrini, B.Sc.
Software Engineer
BUGSENG (https://bugseng.com)
LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253