aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/core/dev.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index fc82f6f6e1c1..14de297d024d 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -640,6 +640,8 @@ int dev_valid_name(const char *name)
640{ 640{
641 if (*name == '\0') 641 if (*name == '\0')
642 return 0; 642 return 0;
643 if (strlen(name) >= IFNAMSIZ)
644 return 0;
643 if (!strcmp(name, ".") || !strcmp(name, "..")) 645 if (!strcmp(name, ".") || !strcmp(name, ".."))
644 return 0; 646 return 0;
645 647
@@ -3191,13 +3193,15 @@ struct net_device *alloc_netdev(int sizeof_priv, const char *name,
3191 struct net_device *dev; 3193 struct net_device *dev;
3192 int alloc_size; 3194 int alloc_size;
3193 3195
3196 BUG_ON(strlen(name) >= sizeof(dev->name));
3197
3194 /* ensure 32-byte alignment of both the device and private area */ 3198 /* ensure 32-byte alignment of both the device and private area */
3195 alloc_size = (sizeof(*dev) + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST; 3199 alloc_size = (sizeof(*dev) + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST;
3196 alloc_size += sizeof_priv + NETDEV_ALIGN_CONST; 3200 alloc_size += sizeof_priv + NETDEV_ALIGN_CONST;
3197 3201
3198 p = kzalloc(alloc_size, GFP_KERNEL); 3202 p = kzalloc(alloc_size, GFP_KERNEL);
3199 if (!p) { 3203 if (!p) {
3200 printk(KERN_ERR "alloc_dev: Unable to allocate device.\n"); 3204 printk(KERN_ERR "alloc_netdev: Unable to allocate device.\n");
3201 return NULL; 3205 return NULL;
3202 } 3206 }
3203 3207