lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210503041706-mutt-send-email-mst@kernel.org>
Date:   Mon, 3 May 2021 04:17:23 -0400
From:   "Michael S. Tsirkin" <mst@...hat.com>
To:     Jason Wang <jasowang@...hat.com>
Cc:     Jiapeng Zhong <abaci-bugfix@...ux.alibaba.com>,
        virtualization@...ts.linux-foundation.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] virtio_ring: boolean values to a bool variable

On Mon, Jan 18, 2021 at 10:57:03AM +0800, Jason Wang wrote:
> 
> On 2021/1/15 下午6:00, Jiapeng Zhong wrote:
> > Fix the following coccicheck warnings:
> > 
> > ./drivers/virtio/virtio_ring.c:1637:1-29: WARNING: Assignment of
> > 0/1 to bool variable.
> > 
> > ./drivers/virtio/virtio_ring.c:1636:1-30: WARNING: Assignment of
> > 0/1 to bool variable.
> > 
> > Reported-by: Abaci Robot <abaci@...ux.alibaba.com>
> > Signed-off-by: Jiapeng Zhong <abaci-bugfix@...ux.alibaba.com>
> 
> 
> It looks to me it's not the only places:
> 
> git grep avail_wrap_counter
> drivers/virtio/virtio_ring.c:                   bool avail_wrap_counter;
> drivers/virtio/virtio_ring.c: vq->packed.avail_wrap_counter ^= 1;
> drivers/virtio/virtio_ring.c: vq->packed.avail_wrap_counter ^= 1;
> drivers/virtio/virtio_ring.c:   if (wrap_counter !=
> vq->packed.avail_wrap_counter)
> drivers/virtio/virtio_ring.c:   vq->packed.avail_wrap_counter = 1;
> 
> Thanks


Agreed if we are doing this let's change them all.

> 
> > ---
> >   drivers/virtio/virtio_ring.c | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> > index 71e16b5..5adb361 100644
> > --- a/drivers/virtio/virtio_ring.c
> > +++ b/drivers/virtio/virtio_ring.c
> > @@ -1633,8 +1633,8 @@ static struct virtqueue *vring_create_virtqueue_packed(
> >   	vq->packed.vring.device = device;
> >   	vq->packed.next_avail_idx = 0;
> > -	vq->packed.avail_wrap_counter = 1;
> > -	vq->packed.used_wrap_counter = 1;
> > +	vq->packed.avail_wrap_counter = true;
> > +	vq->packed.used_wrap_counter = true;
> >   	vq->packed.event_flags_shadow = 0;
> >   	vq->packed.avail_used_flags = 1 << VRING_PACKED_DESC_F_AVAIL;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ