All of lore.kernel.org
 help / color / mirror / Atom feed
From: Prarit Bhargava <prarit@redhat.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: Re: [RFC PATCH]: Fix a warning in the niu driver
Date: Wed, 14 Jul 2010 09:18:31 -0400	[thread overview]
Message-ID: <4C3DB927.2060106@redhat.com> (raw)
In-Reply-To: <20100707.170820.146356362.davem@davemloft.net>


> Your patch would corrupt the list state, since we'd leave
> pages in the rx page hash which have only externally references
> and thus will be freed up.
>
>   

Ah ... I totally missed that.  Thanks for clarifying that Dave.

> Just BUG() if the loop terminates without finding a page.
>
> --------------------
> niu: BUG on inability to find page in rx page hashes.
>
> Signed-off-by: David S. Miller <davem@davemloft.net>
>
> diff --git a/drivers/net/niu.c b/drivers/net/niu.c
> index 3d523cb..5d36531 100644
> --- a/drivers/net/niu.c
> +++ b/drivers/net/niu.c
> @@ -3330,10 +3330,12 @@ static struct page *niu_find_rxpage(struct rx_ring_info *rp, u64 addr,
>  	for (; (p = *pp) != NULL; pp = (struct page **) &p->mapping) {
>  		if (p->index == addr) {
>  			*link = pp;
> -			break;
> +			goto found;
>  		}
>  	}
> +	BUG();
>  
> +found:
>  	return p;
>  }
>   

Dave, would it be acceptable if I then wrapped link in
uninitialized_var() to get rid of the warning I'm trying to resolve?  It
seems that your patch then checks for a valid page value so it should be
okay.

P.


  reply	other threads:[~2010-07-14 13:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-07 23:59 [RFC PATCH]: Fix a warning in the niu driver Prarit Bhargava
2010-07-08  0:08 ` David Miller
2010-07-14 13:18   ` Prarit Bhargava [this message]
2010-07-14 18:28     ` David Miller
2010-07-14 18:26       ` Prarit Bhargava

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=4C3DB927.2060106@redhat.com \
    --to=prarit@redhat.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.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.