linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Donnellan <ajd@linux.ibm.com>
To: Russell Currey <ruscur@russell.cc>, linuxppc-dev@lists.ozlabs.org
Cc: nayna@linux.ibm.com, gjoyce@linux.ibm.com, bgray@linux.ibm.com,
	brking@linux.ibm.com, gcwilson@linux.ibm.com,
	stefanb@linux.ibm.com
Subject: Re: [PATCH 3/4] powerpc/pseries: Expose PLPKS config values, support additional fields
Date: Wed, 04 Jan 2023 18:42:24 +1100	[thread overview]
Message-ID: <6bbf610b9c4bf12639b9ad78e89965c174aca275.camel@linux.ibm.com> (raw)
In-Reply-To: <98d6eb9c3b01c5ed67ff2e8ff812c3f18840a2f7.camel@russell.cc>

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@linux.ibm.com   IBM Australia Limited

  reply	other threads:[~2023-01-04  7:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-20  7:16 [PATCH 0/4] PLPKS bugfixes and enhancements Andrew Donnellan
2022-12-20  7:16 ` [PATCH 1/4] powerpc/pseries: Fix handling of PLPKS object flushing timeout Andrew Donnellan
2023-01-04  3:45   ` Russell Currey
2022-12-20  7:16 ` [PATCH 2/4] powerpc/pseries: Fix alignment of PLPKS structures and buffers Andrew Donnellan
2023-01-04  3:46   ` Russell Currey
2022-12-20  7:16 ` [PATCH 3/4] powerpc/pseries: Expose PLPKS config values, support additional fields Andrew Donnellan
2023-01-04  3:57   ` Russell Currey
2023-01-04  7:42     ` Andrew Donnellan [this message]
2022-12-20  7:16 ` [PATCH 4/4] powerpc/pseries: Implement signed update for PLPKS objects Andrew Donnellan
2023-01-04  4:04   ` Russell Currey
2023-01-04  7:39     ` Andrew Donnellan
2023-01-06 10:54   ` Michael Ellerman
2023-01-09  5:04     ` Andrew Donnellan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6bbf610b9c4bf12639b9ad78e89965c174aca275.camel@linux.ibm.com \
    --to=ajd@linux.ibm.com \
    --cc=bgray@linux.ibm.com \
    --cc=brking@linux.ibm.com \
    --cc=gcwilson@linux.ibm.com \
    --cc=gjoyce@linux.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=nayna@linux.ibm.com \
    --cc=ruscur@russell.cc \
    --cc=stefanb@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).