[PATCH 3/4] powerpc/pseries: Expose PLPKS config values, support additional fields

Andrew Donnellan ajd at linux.ibm.com
Wed Jan 4 18:42:24 AEDT 2023


On Wed, 2023-01-04 at 14:57 +1100, Russell Currey wrote:
> > +       maxobjlabelsize = be16_to_cpu(config->maxobjlabelsize) -
> > +                         MAX_LABEL_ATTR_SIZE;
> > +       maxobjlabelsize = maxobjlabelsize < 0 ? 0 :
> > maxobjlabelsize;
> 
> Isn't a bit of precision lost here?  There has to be a better way to
> handle this.  We get a be16 from the hypervisor, turn it into a u16,
> and assign that to an s16 in order to handle underflow.  Can we just
> check if the size we're given is large enough?  The hypervisor
> documentation also says this value must be at least 255, if we sanity
> check that we don't have to worry about underflow.

Agreed, and it makes more sense for the value that we return to the
user to be the same as the number we actually get from the hypervisor.
I'll fix it in the next spin.

-- 
Andrew Donnellan    OzLabs, ADL Canberra
ajd at linux.ibm.com   IBM Australia Limited


More information about the Linuxppc-dev mailing list