Netdev List
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: Tom Herbert <therbert@google.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org, eric.dumazet@gmail.com
Subject: Re: [PATCH 1/3] net: fail alloc_netdev_mq if queue count < 1
Date: Mon, 18 Oct 2010 22:33:41 +0100	[thread overview]
Message-ID: <1287437621.2252.766.camel@achroite.uk.solarflarecom.com> (raw)
In-Reply-To: <alpine.DEB.1.00.1010181055300.16090@pokey.mtv.corp.google.com>

On Mon, 2010-10-18 at 11:02 -0700, Tom Herbert wrote:
> In alloc_netdev_mq fail if requested queue_count < 1.
> 
> Signed-off-by: Tom Herbert <therbert@google.com>
> ---
>  net/core/dev.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 04972a4..76db105 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -5511,6 +5511,12 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
>  
>  	BUG_ON(strlen(name) >= sizeof(dev->name));
>  
> +	if (queue_count < 0) {
> +		printk(KERN_ERR "alloc_netdev: Unable to allocate device "
> +		       "with zero queues.\n");

Off by one?

Ben.

> +		return NULL;
> +	}
> +
>  	alloc_size = sizeof(struct net_device);
>  	if (sizeof_priv) {
>  		/* ensure 32-byte alignment of private area */

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


  reply	other threads:[~2010-10-18 21:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-18 18:02 [PATCH 1/3] net: fail alloc_netdev_mq if queue count < 1 Tom Herbert
2010-10-18 21:33 ` Ben Hutchings [this message]
2010-10-18 21:46   ` Tom Herbert

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=1287437621.2252.766.camel@achroite.uk.solarflarecom.com \
    --to=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=therbert@google.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox