]> xenbits.xensource.com Git - xtf.git/commit
gnttab: Fix scan-build core.CallAndMessage issues
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 15 Apr 2021 00:36:20 +0000 (01:36 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 16 Apr 2021 22:41:56 +0000 (23:41 +0100)
commitdcd6c07b003c2f5500c8fef79a9405c185b53a87
tree14d3447cd1ca1593d2f52740abccf2d2949923ca
parentdec5fd82e12f5a0af527436c04dea97f1d084110
gnttab: Fix scan-build core.CallAndMessage issues

scan-build complains:

  arch/x86/grant_table.c:41:17: warning: 1st function call argument is an uninitialized value [core.CallAndMessage]
                  pte_from_gfn(gnttab_gfns[i], PF_SYM(AD, RW, P)), UVMF_INVLPG);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

because it can't observe that GNTTABOP_setup_table fills the variable on its
success path.

Initialising the array (which is currently one entry) isn't trivial because
the array is variadic.  Drop the nr_frames variable and use the sizeof()
expression directly, to create compile-time constant size.

A similar issue is reported against xsa-255, but this is trivial to resolve.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
arch/x86/grant_table.c
tests/xsa-255/main.c