[PATCH 1/2] venet-macvlan: correctly remove newline from lower devicename

From: Patrick Mullaney
Date: Wed Dec 02 2009 - 16:11:05 EST


Signed-off-by: Patrick Mullaney <pmullaney@xxxxxxxxxx>
---

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);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/