All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: virtualization@lists.linux-foundation.org,
	Andrew Morton <akpm@linux-foundation.org>,
	lkml - Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH 2/3] Virtio draft IV: the block driver
Date: Fri, 06 Jul 2007 10:33:20 +1000	[thread overview]
Message-ID: <1183682000.6005.108.camel@localhost.localdomain> (raw)
In-Reply-To: <200707050932.50110.borntraeger@de.ibm.com>

On Thu, 2007-07-05 at 09:32 +0200, Christian Borntraeger wrote:
> Am Mittwoch, 4. Juli 2007 schrieb Rusty Russell:
> > +		vbr = mempool_alloc(vblk->pool, GFP_ATOMIC);
> > +		if (!vbr)
> > +			goto stop;
> [...]
> > +		BUG_ON(req->nr_phys_segments > ARRAY_SIZE(vblk->sg));
> > +		vbr->req = req;
> > +		if (!do_req(q, vblk, vbr))
> > +			goto stop;
> [...]
> > +stop:
> > +	/* Queue full?  Wait. */
> > +	blk_stop_queue(q);
> > +	mempool_free(vbr, vblk->pool);
> 
> 
> Hmm, can mempool_free really handle NULL as its first argument? (first goto). 

Good point.  Any objections to fixing that?

Cheers,
Rusty.
===
Christian Borntraeger points out that mempool_free() doesn't noop when
handed NULL.  This is inconsistent with the other free-like functions
in the kernel.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

diff -r a306f0a8de5e mm/mempool.c
--- a/mm/mempool.c	Fri Jul 06 10:28:39 2007 +1000
+++ b/mm/mempool.c	Fri Jul 06 10:29:40 2007 +1000
@@ -263,6 +263,9 @@ void mempool_free(void *element, mempool
 {
 	unsigned long flags;
 
+	if (unlikely(element == NULL))
+		return;
+
 	smp_mb();
 	if (pool->curr_nr < pool->min_nr) {
 		spin_lock_irqsave(&pool->lock, flags);



  parent reply	other threads:[~2007-07-06  0:33 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-04  4:12 [PATCH 1/3] Virtio draft IV Rusty Russell
2007-07-04  4:19 ` [PATCH 2/3] Virtio draft IV: the block driver Rusty Russell
2007-07-04  4:40   ` [PATCH 3/3] Virtio draft IV: the net driver Rusty Russell
2007-07-11 10:28     ` Christian Borntraeger
2007-07-11 11:26       ` Rusty Russell
2007-07-11 11:46         ` Christian Borntraeger
2007-07-12  2:23           ` Rusty Russell
2007-07-11 19:27         ` Caitlin Bestler
2007-07-11 10:45     ` Christian Borntraeger
2007-07-11 11:32       ` Rusty Russell
2007-07-11 20:44       ` David Miller
2007-07-12  2:21         ` Rusty Russell
2007-07-12  2:26           ` David Miller
2007-07-05  7:32   ` [PATCH 2/3] Virtio draft IV: the block driver Christian Borntraeger
2007-07-06  0:33     ` Rusty Russell
2007-07-06  0:33     ` Rusty Russell [this message]
2007-07-23 11:13   ` Christian Borntraeger
2007-07-24  3:02     ` Rusty Russell
  -- strict thread matches above, loose matches on Subject: below --
2007-07-09 14:17 Martin Peschke
2007-07-09 15:54 ` Martin Peschke
2007-07-10  4:42   ` Rusty Russell
2007-07-10 12:12     ` Martin Peschke

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=1183682000.6005.108.camel@localhost.localdomain \
    --to=rusty@rustcorp.com.au \
    --cc=akpm@linux-foundation.org \
    --cc=borntraeger@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --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.