Re: [PATCH] virtiofs: Drop unnecessary initialization in send_forget_request and virtio_fs_get_tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 06, 2022 at 01:38:48AM -0400, Deming Wang wrote:
> The variable is initialized but it is only used after its assignment.
> 
> Signed-off-by: Deming Wang <wangdeming@xxxxxxxxxx>
> ---
>  fs/fuse/virtio_fs.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c
> index 4d8d4f16c..bffe74d44 100644
> --- a/fs/fuse/virtio_fs.c
> +++ b/fs/fuse/virtio_fs.c
> @@ -414,7 +414,7 @@ static int send_forget_request(struct virtio_fs_vq *fsvq,
>  {
>  	struct scatterlist sg;
>  	struct virtqueue *vq;
> -	int ret = 0;
> +	int ret;
>  	bool notify;
>  	struct virtio_fs_forget_req *req = &forget->req;
>  

That causes an uninitialized access in the source tree I'm looking at
(c5e4d5e99162ba8025d58a3af7ad103f155d2df7):

  static int send_forget_request(struct virtio_fs_vq *fsvq,
                     struct virtio_fs_forget *forget,
                     bool in_flight)
  {
      struct scatterlist sg;
      struct virtqueue *vq;
      int ret = 0;
      ^^^^^^^
      bool notify;
      struct virtio_fs_forget_req *req = &forget->req;
  
      spin_lock(&fsvq->lock);
      if (!fsvq->connected) {
          if (in_flight)
              dec_in_flight_req(fsvq);
          kfree(forget);
          goto out;
      ...
      out:
      spin_unlock(&fsvq->lock);
      return ret;
             ^^^
  }

What is the purpose of this patch? Is there a compiler warning (if so,
which compiler and version)? Do you have a static analysis tool that
reported this (if yes, then maybe it's broken)?

Stefan

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux