Thread (13 messages) 13 messages, 3 authors, 2023-01-09

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

From: Andrew Donnellan <hidden>
Date: 2023-01-04 07:43:29

On Wed, 2023-01-04 at 14:57 +1100, Russell Currey wrote:
quoted
+       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@linux.ibm.com   IBM Australia Limited
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help