diff options
-rw-r--r-- | net/core/pktgen.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 8a90bf79261a..b597ef1771f4 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -2869,12 +2869,10 @@ static int pktgen_add_device(struct pktgen_thread *t, const char* ifname) | |||
2869 | 2869 | ||
2870 | if( (pkt_dev = __pktgen_NN_threads(ifname, FIND)) == NULL) { | 2870 | if( (pkt_dev = __pktgen_NN_threads(ifname, FIND)) == NULL) { |
2871 | 2871 | ||
2872 | pkt_dev = kmalloc(sizeof(struct pktgen_dev), GFP_KERNEL); | 2872 | pkt_dev = kzalloc(sizeof(struct pktgen_dev), GFP_KERNEL); |
2873 | if (!pkt_dev) | 2873 | if (!pkt_dev) |
2874 | return -ENOMEM; | 2874 | return -ENOMEM; |
2875 | 2875 | ||
2876 | memset(pkt_dev, 0, sizeof(struct pktgen_dev)); | ||
2877 | |||
2878 | pkt_dev->flows = vmalloc(MAX_CFLOWS*sizeof(struct flow_state)); | 2876 | pkt_dev->flows = vmalloc(MAX_CFLOWS*sizeof(struct flow_state)); |
2879 | if (pkt_dev->flows == NULL) { | 2877 | if (pkt_dev->flows == NULL) { |
2880 | kfree(pkt_dev); | 2878 | kfree(pkt_dev); |
@@ -2958,13 +2956,12 @@ static int pktgen_create_thread(const char* name, int cpu) | |||
2958 | return -EINVAL; | 2956 | return -EINVAL; |
2959 | } | 2957 | } |
2960 | 2958 | ||
2961 | t = (struct pktgen_thread*)(kmalloc(sizeof(struct pktgen_thread), GFP_KERNEL)); | 2959 | t = kzalloc(sizeof(struct pktgen_thread), GFP_KERNEL); |
2962 | if (!t) { | 2960 | if (!t) { |
2963 | printk("pktgen: ERROR: out of memory, can't create new thread.\n"); | 2961 | printk("pktgen: ERROR: out of memory, can't create new thread.\n"); |
2964 | return -ENOMEM; | 2962 | return -ENOMEM; |
2965 | } | 2963 | } |
2966 | 2964 | ||
2967 | memset(t, 0, sizeof(struct pktgen_thread)); | ||
2968 | strcpy(t->name, name); | 2965 | strcpy(t->name, name); |
2969 | spin_lock_init(&t->if_lock); | 2966 | spin_lock_init(&t->if_lock); |
2970 | t->cpu = cpu; | 2967 | t->cpu = cpu; |