|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2 4/5] libxc/PM: Ensure pxstat buffers are correctly sized
On Mon, May 26, 2025 at 3:04 PM Anthony PERARD <anthony@xxxxxxxxxxxxxx> wrote:
>
> On Mon, May 12, 2025 at 03:46:55PM +0100, Ross Lagerwall wrote:
> > diff --git a/tools/libs/ctrl/xc_pm.c b/tools/libs/ctrl/xc_pm.c
> > index ff7b5ada053f..cffbd1b8a955 100644
> > --- a/tools/libs/ctrl/xc_pm.c
> > +++ b/tools/libs/ctrl/xc_pm.c
> > @@ -46,35 +46,33 @@ int xc_pm_get_pxstat(xc_interface *xch, int cpuid,
> > struct xc_px_stat *pxpt)
> > {
> > struct xen_sysctl sysctl = {};
> > /* Sizes unknown until xc_pm_get_max_px */
>
> This comment can be removed now.
>
> > - DECLARE_NAMED_HYPERCALL_BOUNCE(trans, pxpt->trans_pt, 0,
> > XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
> > - DECLARE_NAMED_HYPERCALL_BOUNCE(pt, pxpt->pt, 0,
> > XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
> > + DECLARE_NAMED_HYPERCALL_BOUNCE(trans, pxpt->trans_pt,
> > + pxpt->total * pxpt->total,
> > + XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
> > + DECLARE_NAMED_HYPERCALL_BOUNCE(pt, pxpt->pt, pxpt->total,
> > + XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
>
> I don't think the macro takes the sizeof(*pt) or sizeof(*trans_pt) into
> account when using the size provided. So it doesn't looks like you can
> use `pxpt->total` alone, and you still need to multiple it by sizeof(*)
> like it was done in the HYPERCALL_BOUNCE_SET_SIZE() call.
Indeed I realized this when testing a v3 of this series. I'll send a
new version now.
Thanks,
Ross
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |