diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/rose/af_rose.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c index dbfb0e3dc798..0f96565a64ec 100644 --- a/net/rose/af_rose.c +++ b/net/rose/af_rose.c | |||
@@ -1472,24 +1472,25 @@ static const char banner[] = KERN_INFO "F6FBB/G4KLX ROSE for Linux. Version 0.62 | |||
1472 | static int __init rose_proto_init(void) | 1472 | static int __init rose_proto_init(void) |
1473 | { | 1473 | { |
1474 | int i; | 1474 | int i; |
1475 | int rc = proto_register(&rose_proto, 0); | 1475 | int rc; |
1476 | 1476 | ||
1477 | if (rose_ndevs > 0x7FFFFFFF/sizeof(struct net_device *)) { | ||
1478 | printk(KERN_ERR "ROSE: rose_proto_init - rose_ndevs parameter to large\n"); | ||
1479 | rc = -EINVAL; | ||
1480 | goto out; | ||
1481 | } | ||
1482 | |||
1483 | rc = proto_register(&rose_proto, 0); | ||
1477 | if (rc != 0) | 1484 | if (rc != 0) |
1478 | goto out; | 1485 | goto out; |
1479 | 1486 | ||
1480 | rose_callsign = null_ax25_address; | 1487 | rose_callsign = null_ax25_address; |
1481 | 1488 | ||
1482 | if (rose_ndevs > 0x7FFFFFFF/sizeof(struct net_device *)) { | ||
1483 | printk(KERN_ERR "ROSE: rose_proto_init - rose_ndevs parameter to large\n"); | ||
1484 | proto_unregister(&rose_proto); | ||
1485 | return -EINVAL; | ||
1486 | } | ||
1487 | |||
1488 | dev_rose = kmalloc(rose_ndevs * sizeof(struct net_device *), GFP_KERNEL); | 1489 | dev_rose = kmalloc(rose_ndevs * sizeof(struct net_device *), GFP_KERNEL); |
1489 | if (dev_rose == NULL) { | 1490 | if (dev_rose == NULL) { |
1490 | printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate device structure\n"); | 1491 | printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate device structure\n"); |
1491 | proto_unregister(&rose_proto); | 1492 | rc = -ENOMEM; |
1492 | return -ENOMEM; | 1493 | goto out_proto_unregister; |
1493 | } | 1494 | } |
1494 | 1495 | ||
1495 | memset(dev_rose, 0x00, rose_ndevs * sizeof(struct net_device*)); | 1496 | memset(dev_rose, 0x00, rose_ndevs * sizeof(struct net_device*)); |
@@ -1540,6 +1541,7 @@ fail: | |||
1540 | free_netdev(dev_rose[i]); | 1541 | free_netdev(dev_rose[i]); |
1541 | } | 1542 | } |
1542 | kfree(dev_rose); | 1543 | kfree(dev_rose); |
1544 | out_proto_unregister: | ||
1543 | proto_unregister(&rose_proto); | 1545 | proto_unregister(&rose_proto); |
1544 | goto out; | 1546 | goto out; |
1545 | } | 1547 | } |