All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sven Schnelle <svens@stackframe.org>
To: P J P <ppandit@redhat.com>
Cc: Li Qiang <pangpei.lq@antfin.com>,
	Jason Wang <jasowang@redhat.com>,
	Qemu Developers <qemu-devel@nongnu.org>,
	Ziming Zhang <ezrakiez@gmail.com>,
	Prasad J Pandit <pjp@fedoraproject.org>
Subject: Re: [PATCH] net: tulip: check frame size and r/w data length
Date: Sat, 15 Feb 2020 10:21:32 +0100	[thread overview]
Message-ID: <20200215092132.GE18657@t470p.stackframe.org> (raw)
In-Reply-To: <20200211073930.224024-1-ppandit@redhat.com>

Hi,

thanks for your patch.

On Tue, Feb 11, 2020 at 01:09:30PM +0530, P J P wrote:
> From: Prasad J Pandit <pjp@fedoraproject.org>
> diff --git a/hw/net/tulip.c b/hw/net/tulip.c
> index cfac2719d3..aca2a3f17f 100644
> --- a/hw/net/tulip.c
> +++ b/hw/net/tulip.c
> @@ -164,27 +164,35 @@ static void tulip_copy_rx_bytes(TULIPState *s, struct tulip_descriptor *desc)
>      int len2 = (desc->control >> RDES1_BUF2_SIZE_SHIFT) & RDES1_BUF2_SIZE_MASK;
>      int len;
>  
> -    if (s->rx_frame_len && len1) {
> -        if (s->rx_frame_len > len1) {
> -            len = len1;
> -        } else {
> -            len = s->rx_frame_len;
> -        }
> -        pci_dma_write(&s->dev, desc->buf_addr1, s->rx_frame +
> -            (s->rx_frame_size - s->rx_frame_len), len);
> -        s->rx_frame_len -= len;
> +    if (!len1 || !len2 || !s->rx_frame_len) {
> +        return;

I haven't tested the patch yet, but would that work if the guest OS passes
only one buffer to the card? I.e. len1 = x, and len2 = 0 because only
buffer 1 is available?

Regards
Sven


  reply	other threads:[~2020-02-15  9:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-11  7:39 [PATCH] net: tulip: check frame size and r/w data length P J P
2020-02-15  9:21 ` Sven Schnelle [this message]
2020-02-17  9:20   ` P J P

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=20200215092132.GE18657@t470p.stackframe.org \
    --to=svens@stackframe.org \
    --cc=ezrakiez@gmail.com \
    --cc=jasowang@redhat.com \
    --cc=pangpei.lq@antfin.com \
    --cc=pjp@fedoraproject.org \
    --cc=ppandit@redhat.com \
    --cc=qemu-devel@nongnu.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.