All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [PULL 04/11] target/arm/cpu64: max cpu: Introduce sve<N> properties
Date: Wed, 13 Nov 2019 21:30:41 +0000	[thread overview]
Message-ID: <CAFEAcA9KwEzNoyugPNjqBmOb-F7EWWJ=0kf6ysD3mDk_R9v=DA@mail.gmail.com> (raw)
In-Reply-To: <ac0c7520-2f6b-fb49-c725-37b46272c835@linaro.org>

On Wed, 13 Nov 2019 at 20:17, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> On 11/12/19 11:23 AM, Peter Maydell wrote:
> >> +static uint32_t sve_zcr_get_valid_len(ARMCPU *cpu, uint32_t start_len)
> >> +{
> >> +    uint32_t start_vq = (start_len & 0xf) + 1;
> >> +
> >> +    return arm_cpu_vq_map_next_smaller(cpu, start_vq + 1) - 1;
> >
> > "Subtract operation overflows on operands
> > arm_cpu_vq_map_next_smaller(cpu, start_vq + 1U) and 1U"
> >
> > Certainly it looks as if arm_cpu_vq_map_next_smaller() can
> > return 0, and claiming the valid length to be UINT_MAX
> > seems a bit odd in that case.
>
> The lsb is always set in the map, the minimum number we send to next_smaller is
> 2 -> so the minimum number returned from next_smaller is 1.
>
> We should never return UINT_MAX.
>
> >     return bitnum == vq - 1 ? 0 : bitnum + 1;
>
> But yes, this computation doesn't seem right.
>
> The beginning assert should probably be (vq >= 2 ...)
> and here we should assert bitnum != vq - 1.

Coverity may also be looking at the case where
TARGET_AARCH64 is not defined. The fallback definition
of arm_cpu_vq_map_next_smaller() for that situation
always returns 0.

thanks
-- PMM


  reply	other threads:[~2019-11-13 21:32 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-01  8:51 [PULL 00/11] target-arm queue Peter Maydell
2019-11-01  8:51 ` [PULL 01/11] target/arm/monitor: Introduce qmp_query_cpu_model_expansion Peter Maydell
2019-11-01  8:51 ` [PULL 02/11] tests: arm: Introduce cpu feature tests Peter Maydell
2019-11-01  8:51 ` [PULL 03/11] target/arm: Allow SVE to be disabled via a CPU property Peter Maydell
2019-11-01  8:51 ` [PULL 04/11] target/arm/cpu64: max cpu: Introduce sve<N> properties Peter Maydell
2019-11-12 10:23   ` Peter Maydell
2019-11-13 20:17     ` Richard Henderson
2019-11-13 21:30       ` Peter Maydell [this message]
2019-11-15  8:29         ` Richard Henderson
2019-11-01  8:51 ` [PULL 05/11] target/arm/kvm64: Add kvm_arch_get/put_sve Peter Maydell
2019-11-01  8:51 ` [PULL 06/11] target/arm/kvm64: max cpu: Enable SVE when available Peter Maydell
2019-11-01  8:51 ` [PULL 07/11] target/arm/kvm: scratch vcpu: Preserve input kvm_vcpu_init features Peter Maydell
2019-11-01  8:51 ` [PULL 08/11] target/arm/cpu64: max cpu: Support sve properties with KVM Peter Maydell
2019-11-01  8:51 ` [PULL 09/11] target/arm/kvm: host cpu: Add support for sve<N> properties Peter Maydell
2022-02-03 16:46   ` Peter Maydell
2022-02-03 17:36     ` Andrew Jones
2022-02-03 17:40       ` Peter Maydell
2022-02-04 11:26         ` Andrew Jones
2019-11-01  8:51 ` [PULL 10/11] hw/arm/boot: Rebuild hflags when modifying CPUState at boot Peter Maydell
2019-11-01  8:51 ` [PULL 11/11] target/arm: Allow reading flags from FPSCR for M-profile Peter Maydell
2019-11-01  9:30 ` [PULL 00/11] target-arm queue Peter Maydell
2019-11-01  9:54   ` Andrew Jones
2019-11-01 10:34     ` Peter Maydell
2019-11-01 12:53       ` Peter Maydell
2019-11-01 14:25         ` Andrew Jones
2019-11-02 17:57           ` Peter Maydell

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='CAFEAcA9KwEzNoyugPNjqBmOb-F7EWWJ=0kf6ysD3mDk_R9v=DA@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.