netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Andy Green <andy.green@linaro.org>
Cc: linux-omap@vger.kernel.org, s-jan@ti.com, arnd@arndb.de,
	patches@linaro.org, tony@atomide.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, rostedt@goodmis.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 4 2/4] NET ethernet introduce mac_platform helper
Date: Wed, 04 Jul 2012 20:12:43 -0700	[thread overview]
Message-ID: <1341457963.2058.13.camel@joe2Laptop> (raw)
In-Reply-To: <20120705024446.26317.49693.stgit@build.warmcat.com>

On Thu, 2012-07-05 at 10:44 +0800, Andy Green wrote:
> From: Andy Green <andy@warmcat.com>
> 
> This introduces a small helper in net/ethernet, which registers a network
> notifier at core_initcall time, and accepts registrations mapping expected
> asynchronously-probed network device paths (like, "usb1/1-1/1-1.1/1-1.1:1.0")
> and the MAC that is needed to be assigned to the device when it appears.

The mac prefix is poor.  I think eth_mac is better.

[]

> diff --git a/net/ethernet/mac-platform.c b/net/ethernet/mac-platform.c
[]
> +static int mac_platform_netdev_event(struct notifier_block *this,
> +						unsigned long event, void *ptr)

alignment to parenthesis please.

[]

> +int mac_platform_register_device_macs(const struct mac_platform *macs)
> +{
[]
> +		next = kmalloc(sizeof(struct mac_platform), GFP_KERNEL);
> +		if (!next) {
> +			ret = -ENOMEM;
> +			goto bail;
> +		}
> +
> +		next->device_path = kmalloc(strlen(macs->device_path) + 1,
> +								   GFP_KERNEL);
> +		if (!next->device_path) {
> +			ret = -ENOMEM;
> +			goto bail;
> +		}
> +
> +		strcpy(next->device_path, macs->device_path);
> +		memcpy(next->mac, macs->mac, sizeof macs->mac);

kmemdup and kstrdup()

> +		list_add(&next->list, &mac_platform_list);
> +
> +		macs++;
> +	}
> +
> +bail:
> +	mutex_unlock(&mac_platform_mutex);
> +
> +	return ret;
> +}

leaking memory on failures.

  reply	other threads:[~2012-07-05  3:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-05  2:44 [PATCH 4 0/4] Add ability to set defaultless network device MAC addresses to deterministic computed locally administered values Andy Green
2012-07-05  2:44 ` [PATCH 4 1/4] OMAP: add cpu id register to MAC address helper Andy Green
2012-07-05  2:44 ` [PATCH 4 2/4] NET ethernet introduce mac_platform helper Andy Green
2012-07-05  3:12   ` Joe Perches [this message]
2012-07-05  3:20     ` Andy Green
2012-07-05  3:25       ` Joe Perches
2012-07-06 22:40   ` Ben Hutchings
2012-07-05  2:44 ` [PATCH 4 3/4] OMAP4 PANDA register ethernet and wlan for automatic mac allocation Andy Green
2012-07-05  2:45 ` [PATCH 4 4/4] config test config extending omap2plus with wl12xx etc Andy Green
2012-07-10 12:37 ` [PATCH 4 0/4] Add ability to set defaultless network device MAC addresses to deterministic computed locally administered values Florian Fainelli
2012-07-10 12:58   ` "Andy Green (林安廸)"
2012-07-10 13:08     ` Steven Rostedt
2012-07-10 15:20     ` Alan Cox

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=1341457963.2058.13.camel@joe2Laptop \
    --to=joe@perches.com \
    --cc=andy.green@linaro.org \
    --cc=arnd@arndb.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=patches@linaro.org \
    --cc=rostedt@goodmis.org \
    --cc=s-jan@ti.com \
    --cc=tony@atomide.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;
as well as URLs for NNTP newsgroup(s).