From: Stephen Hemminger <shemminger@vyatta.com>
To: Sven Hartge <sven@svenhartge.de>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] via-velocity: earlier name allocation
Date: Wed, 22 Oct 2008 17:04:22 -0700 [thread overview]
Message-ID: <20081022170422.7851ea9a@extreme> (raw)
In-Reply-To: <alpine.DEB.2.00.0810230114180.17076@ds9.feds.ath.cx>
On Thu, 23 Oct 2008 01:24:25 +0200 (CEST)
Sven Hartge <sven@svenhartge.de> wrote:
> Hi.
>
> This is my first attempt at a kernel patch ever, so please be gentle :)
> (And please CC me, as I am not subscribed to netdev.)
>
> This patch corrects a cosmetic bug in the via-velocity driver which
> bothered me for some time.
>
> The messages printed during device init look like the following:
>
> [ 8.486422] eth%d: set value of parameter Wake On Lan options to 0
> ^^!
> [ 8.487340] eth0: VIA Networking Velocity Family Gigabit Ethernet Adapter
>
> Note the unresolved format string.
>
> I just copied and adapted the name allocation code from register_netdev
> and call it before the first use of dev->name
>
> Even if my attempt is incorrect, it should give you an idea what needs
> fixing here.
>
> Signed-off-by: Sven Hartge <sven@svenhartge.de>
>
> diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
> index 2dced38..15f2c19 100644
> --- a/drivers/net/via-velocity.c
> +++ b/drivers/net/via-velocity.c
> @@ -934,6 +934,16 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi
> for (i = 0; i < 6; i++)
> dev->dev_addr[i] = readb(®s->PAR[i]);
>
> + /*
> + * Do name allocation.
> + */
> +
> + if (strchr(dev->name, '%')) {
> + ret = dev_alloc_name(dev, dev->name);
> + if (ret < 0)
> + dev_err(&pdev->dev, "Name allocation failed.\n");
> + goto err_disable;
> + }
>
> velocity_get_options(&vptr->options, velocity_nics, dev->name);
>
NAK
There is nothing to prevent that device name from being allocated by another device
at that point. The correct fix is to not use dev->name until after registering
the network device. Change the order of registration or pass dev_driver_string(&pdev->dev)
instead of dev->name to velocity_get_options
next prev parent reply other threads:[~2008-10-23 0:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-22 23:24 [PATCH] via-velocity: earlier name allocation Sven Hartge
2008-10-23 0:04 ` Stephen Hemminger [this message]
2008-10-23 7:29 ` Sven Hartge
2008-10-23 23:03 ` [PATCH v2] via-velocity: use driver string instead of dev->name before register_netdev() Sven Hartge
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=20081022170422.7851ea9a@extreme \
--to=shemminger@vyatta.com \
--cc=netdev@vger.kernel.org \
--cc=sven@svenhartge.de \
/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;
as well as URLs for NNTP newsgroup(s).