All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: sgarzare@redhat.com
Cc: virtualization@lists.linux-foundation.org
Subject: Re: [bug report] vdpa_sim_blk: implement ramdisk behaviour
Date: Wed, 29 Sep 2021 14:46:52 +0300	[thread overview]
Message-ID: <20210929114652.GV2083@kadam> (raw)
In-Reply-To: <20210929113742.GA7928@kili>

On Wed, Sep 29, 2021 at 02:37:42PM +0300, Dan Carpenter wrote:
>     89         /* The last byte is the status and we checked if the last iov has
>     90          * enough room for it.
>     91          */
>     92         to_push = vringh_kiov_length(&vq->in_iov) - 1;
> 
> Are you positive that vringh_kiov_length() cannot be zero?  I looked at
> the range_check() and there is no check for "if (*len == 0)".
> 
>     93 
>     94         to_pull = vringh_kiov_length(&vq->out_iov);
>     95 
>     96         bytes = vringh_iov_pull_iotlb(&vq->vring, &vq->out_iov, &hdr,
>     97                                       sizeof(hdr));
>     98         if (bytes != sizeof(hdr)) {
>     99                 dev_err(&vdpasim->vdpa.dev, "request out header too short\n");
>     100                 return false;
>     101         }
>     102 
>     103         to_pull -= bytes;
> 
> The same "bytes" is used for both to_pull and to_push.  In this
> assignment it would only be used for the default case which prints an
> error message.
> 

Sorry, no.  This part is wrong.  "bytes" is not used for "to_push"
either here or below.  But I still am not sure "*len == 0" or how we
know that "to_push >= VIRTIO_BLK_ID_BYTES".

regards,
dan carpenter

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  reply	other threads:[~2021-09-29 11:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-29 11:37 [bug report] vdpa_sim_blk: implement ramdisk behaviour Dan Carpenter
2021-09-29 11:46 ` Dan Carpenter [this message]
2021-09-29 12:07   ` Stefano Garzarella
2021-09-29 13:22     ` Dan Carpenter

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=20210929114652.GV2083@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=sgarzare@redhat.com \
    --cc=virtualization@lists.linux-foundation.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.