Messages in this thread Patch in this message | | | From | Patrick Mullaney <> | Subject | [PATCH 1/2] venet-macvlan: correctly remove newline from lower device name | Date | Wed, 02 Dec 2009 16:10:26 -0500 |
| |
Signed-off-by: Patrick Mullaney <pmullaney@novell.com> ---
kernel/vbus/devices/venet/macvlan.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/kernel/vbus/devices/venet/macvlan.c b/kernel/vbus/devices/venet/macvlan.c index 8724e26..432ff5d 100644 --- a/kernel/vbus/devices/venet/macvlan.c +++ b/kernel/vbus/devices/venet/macvlan.c @@ -350,7 +350,11 @@ ll_ifname_store(struct vbus_device *dev, struct vbus_device_attribute *attr, if (priv->dev.vbus.opened) return -EINVAL; - strncpy(priv->ll_ifname, buf, count-1); + memcpy(priv->ll_ifname, buf, count); + + /* remove trailing newline if present */ + if (priv->ll_ifname[count-1] == '\n') + priv->ll_ifname[count-1] = '\0'; if (priv->mdev.lowerdev) { dev_put(priv->mdev.lowerdev);
| |