From: David Miller <davem@davemloft.net>
To: shemminger@vyatta.com
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] net: network device name ifalias support
Date: Mon, 22 Sep 2008 19:44:23 -0700 (PDT) [thread overview]
Message-ID: <20080922.194423.116365505.davem@davemloft.net> (raw)
In-Reply-To: <20080922174346.2ad15d26@extreme>
From: Stephen Hemminger <shemminger@vyatta.com>
Date: Mon, 22 Sep 2008 17:43:46 -0700
> + dev->ifalias = krealloc(dev->ifalias, len+1, GFP_KERNEL);
> + if (!dev->ifalias)
> + return -ENOMEM;
> +
> + strlcpy(dev->ifalias, alias, len+1);
> + return len;
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.
next prev parent reply other threads:[~2008-09-23 2:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-23 0:43 [PATCH] net: network device name ifalias support Stephen Hemminger
2008-09-23 2:44 ` David Miller [this message]
2008-09-23 3:47 ` Stephen Hemminger
2008-09-23 4:28 ` David Miller
2008-09-23 19:52 ` [PATCH net-next]: net: remove ifalias on empty given alias Oliver Hartkopp
2008-09-23 20:14 ` Stephen Hemminger
2008-09-24 4:23 ` David Miller
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=20080922.194423.116365505.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=shemminger@vyatta.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).