Re: [PATCH] net: network device name ifalias support

From
David Miller <davem@davemloft.net>
Date
2008-09-23 04:28:46
Reply to
Stephen Hemminger, 2008-09-23
From: Stephen Hemminger <redacted>
Date: Mon, 22 Sep 2008 20:47:18 -0700
On Mon, 22 Sep 2008 19:44:23 -0700 (PDT)
David Miller [off-list ref] wrote:
quoted
It might be cleaner to use kstrdup() and free the old pointer, if
any, here.

	char *new = kstrdup(alias, GFP_KERNEL);
	if (!new)
		return -ENOMEM;
	kfree(dev->ifalias);
	dev->ifalias = new;
	return len;

That way all of this "len+1" stuff goes away.
Won't work because input string is not necessarily null-terminated.
In the sysfs case we want there is a trailing newline, and this
way avoids copying once there and then copying again.
Ok, fair enough.  I've applied your original patch to net-next-2.6,
thanks!
Thread (7 messages) 7 messages, 3 authors, last reply 2008-09-24
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help