]>
libxc/PM: Ensure pxstat buffers are correctly sized
authorRoss Lagerwall <ross.lagerwall@citrix.com>
Wed, 11 Jun 2025 09:06:45 +0000 (11:06 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 11 Jun 2025 09:06:45 +0000 (11:06 +0200)
commitde6a05a8a0d5090f1cdb9b5449b034afcbe7a208
tree35c4b5ed3d59dd67ff11c5603d739a37ac350342
parent2f36bef3d8478f304f262fffeca543de480872a4
libxc/PM: Ensure pxstat buffers are correctly sized

xc_pm_get_pxstat() requires the caller to allocate the pt and trans_pt
buffers but then calls xc_pm_get_max_px() to determine how big they are
(and hence how much Xen will copy into them). This is susceptible to
races if xc_pm_get_max_px() changes so avoid the problem by requiring
the caller to also pass in the size of the buffers.

Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
tools/libs/ctrl/xc_pm.c
tools/misc/xenpm.c