Linux KVM/arm64 development list
 help / color / mirror / Atom feed
From: Oliver Upton <oliver.upton@linux.dev>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: kvmarm@lists.linux.dev
Subject: Re: [bug report] KVM: arm64: Relax invariance of KVM_ARM_VCPU_POWER_OFF
Date: Thu, 22 Jun 2023 17:20:01 +0000	[thread overview]
Message-ID: <ZJSCwWF/nFFkXY+W@linux.dev> (raw)
In-Reply-To: <50fed6cc-5772-4bb2-b72a-bc7e4f9e93d2@moroto.mountain>

Hey Dan,

On Thu, Jun 22, 2023 at 03:49:18PM +0300, Dan Carpenter wrote:
> Hello Oliver Upton,
> 
> The patch e3c1c0cae31e: "KVM: arm64: Relax invariance of
> KVM_ARM_VCPU_POWER_OFF" from Jun 9, 2023, leads to the following
> Smatch static checker warning:
> 
> 	arch/arm64/kvm/arm.c:1283 kvm_arch_vcpu_ioctl_vcpu_init()
> 	warn: bitwise AND condition is false here
> 
> arch/arm64/kvm/arm.c
>     1272 static int kvm_arch_vcpu_ioctl_vcpu_init(struct kvm_vcpu *vcpu,
>     1273                                          struct kvm_vcpu_init *init)
>     1274 {
>     1275         bool power_off = false;
>     1276         int ret;
>     1277 
>     1278         /*
>     1279          * Treat the power-off vCPU feature as ephemeral. Clear the bit to avoid
>     1280          * reflecting it in the finalized feature set, thus limiting its scope
>     1281          * to a single KVM_ARM_VCPU_INIT call.
>     1282          */
> --> 1283         if (init->features[0] & KVM_ARM_VCPU_POWER_OFF) {
> 
> Prior to this commit KVM_ARM_VCPU_POWER_OFF was a bit number.  I think
> it still should be.  As in:
> 
> #define KVM_ARM_VCPU_POWER_OFF BIT(0)
> 
>     1284                 init->features[0] &= ~KVM_ARM_VCPU_POWER_OFF;
>     1285                 power_off = true;
>     1286         }
>     1287 
>     1288         ret = kvm_vcpu_set_target(vcpu, init);
>     1289         if (ret)
>     1290                 return ret;
>     1291 

Thanks for the bug report. I had to go find my brown paper bag, but the
fix is now queued up for 6.5:

https://lore.kernel.org/kvmarm/20230622160922.1925530-1-oliver.upton@linux.dev/

-- 
Thanks,
Oliver

      reply	other threads:[~2023-06-22 17:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-22 12:49 [bug report] KVM: arm64: Relax invariance of KVM_ARM_VCPU_POWER_OFF Dan Carpenter
2023-06-22 17:20 ` Oliver Upton [this message]

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=ZJSCwWF/nFFkXY+W@linux.dev \
    --to=oliver.upton@linux.dev \
    --cc=dan.carpenter@linaro.org \
    --cc=kvmarm@lists.linux.dev \
    /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