diff options
author | Eric Sesterhenn <snakebyte@gmx.de> | 2006-03-24 06:15:31 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-24 10:33:18 -0500 |
commit | 88abaab4f9b08381e30e737980a1c49d6b524dfc (patch) | |
tree | d33aa82674c00c37cd293c9e888cff785880ce5a /drivers/s390/net | |
parent | fb630517f0d0736ea73af07d6b357be9ad67e6f1 (diff) |
[PATCH] s390: kzalloc() conversion in drivers/s390
Convert all kmalloc + memset sequences in drivers/s390 to kzalloc usage.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/s390/net')
-rw-r--r-- | drivers/s390/net/claw.c | 3 | ||||
-rw-r--r-- | drivers/s390/net/fsm.c | 10 | ||||
-rw-r--r-- | drivers/s390/net/iucv.c | 11 | ||||
-rw-r--r-- | drivers/s390/net/lcs.c | 11 | ||||
-rw-r--r-- | drivers/s390/net/netiucv.c | 7 | ||||
-rw-r--r-- | drivers/s390/net/qeth_eddp.c | 13 | ||||
-rw-r--r-- | drivers/s390/net/qeth_main.c | 20 | ||||
-rw-r--r-- | drivers/s390/net/qeth_sys.c | 3 |
8 files changed, 25 insertions, 53 deletions
diff --git a/drivers/s390/net/claw.c b/drivers/s390/net/claw.c index acd2a3f005f1..23d53bf9daf1 100644 --- a/drivers/s390/net/claw.c +++ b/drivers/s390/net/claw.c | |||
@@ -310,7 +310,7 @@ claw_probe(struct ccwgroup_device *cgdev) | |||
310 | printk(KERN_INFO "claw: variable cgdev =\n"); | 310 | printk(KERN_INFO "claw: variable cgdev =\n"); |
311 | dumpit((char *)cgdev, sizeof(struct ccwgroup_device)); | 311 | dumpit((char *)cgdev, sizeof(struct ccwgroup_device)); |
312 | #endif | 312 | #endif |
313 | privptr = kmalloc(sizeof(struct claw_privbk), GFP_KERNEL); | 313 | privptr = kzalloc(sizeof(struct claw_privbk), GFP_KERNEL); |
314 | if (privptr == NULL) { | 314 | if (privptr == NULL) { |
315 | probe_error(cgdev); | 315 | probe_error(cgdev); |
316 | put_device(&cgdev->dev); | 316 | put_device(&cgdev->dev); |
@@ -319,7 +319,6 @@ claw_probe(struct ccwgroup_device *cgdev) | |||
319 | CLAW_DBF_TEXT_(2,setup,"probex%d",-ENOMEM); | 319 | CLAW_DBF_TEXT_(2,setup,"probex%d",-ENOMEM); |
320 | return -ENOMEM; | 320 | return -ENOMEM; |
321 | } | 321 | } |
322 | memset(privptr,0x00,sizeof(struct claw_privbk)); | ||
323 | privptr->p_mtc_envelope= kmalloc( MAX_ENVELOPE_SIZE, GFP_KERNEL); | 322 | privptr->p_mtc_envelope= kmalloc( MAX_ENVELOPE_SIZE, GFP_KERNEL); |
324 | privptr->p_env = kmalloc(sizeof(struct claw_env), GFP_KERNEL); | 323 | privptr->p_env = kmalloc(sizeof(struct claw_env), GFP_KERNEL); |
325 | if ((privptr->p_mtc_envelope==NULL) || (privptr->p_env==NULL)) { | 324 | if ((privptr->p_mtc_envelope==NULL) || (privptr->p_env==NULL)) { |
diff --git a/drivers/s390/net/fsm.c b/drivers/s390/net/fsm.c index 6caf5fa6a3b5..7145e2134cf0 100644 --- a/drivers/s390/net/fsm.c +++ b/drivers/s390/net/fsm.c | |||
@@ -21,38 +21,34 @@ init_fsm(char *name, const char **state_names, const char **event_names, int nr_ | |||
21 | fsm_function_t *m; | 21 | fsm_function_t *m; |
22 | fsm *f; | 22 | fsm *f; |
23 | 23 | ||
24 | this = (fsm_instance *)kmalloc(sizeof(fsm_instance), order); | 24 | this = kzalloc(sizeof(fsm_instance), order); |
25 | if (this == NULL) { | 25 | if (this == NULL) { |
26 | printk(KERN_WARNING | 26 | printk(KERN_WARNING |
27 | "fsm(%s): init_fsm: Couldn't alloc instance\n", name); | 27 | "fsm(%s): init_fsm: Couldn't alloc instance\n", name); |
28 | return NULL; | 28 | return NULL; |
29 | } | 29 | } |
30 | memset(this, 0, sizeof(fsm_instance)); | ||
31 | strlcpy(this->name, name, sizeof(this->name)); | 30 | strlcpy(this->name, name, sizeof(this->name)); |
32 | 31 | ||
33 | f = (fsm *)kmalloc(sizeof(fsm), order); | 32 | f = kzalloc(sizeof(fsm), order); |
34 | if (f == NULL) { | 33 | if (f == NULL) { |
35 | printk(KERN_WARNING | 34 | printk(KERN_WARNING |
36 | "fsm(%s): init_fsm: Couldn't alloc fsm\n", name); | 35 | "fsm(%s): init_fsm: Couldn't alloc fsm\n", name); |
37 | kfree_fsm(this); | 36 | kfree_fsm(this); |
38 | return NULL; | 37 | return NULL; |
39 | } | 38 | } |
40 | memset(f, 0, sizeof(fsm)); | ||
41 | f->nr_events = nr_events; | 39 | f->nr_events = nr_events; |
42 | f->nr_states = nr_states; | 40 | f->nr_states = nr_states; |
43 | f->event_names = event_names; | 41 | f->event_names = event_names; |
44 | f->state_names = state_names; | 42 | f->state_names = state_names; |
45 | this->f = f; | 43 | this->f = f; |
46 | 44 | ||
47 | m = (fsm_function_t *)kmalloc( | 45 | m = kcalloc(nr_states*nr_events, sizeof(fsm_function_t), order); |
48 | sizeof(fsm_function_t) * nr_states * nr_events, order); | ||
49 | if (m == NULL) { | 46 | if (m == NULL) { |
50 | printk(KERN_WARNING | 47 | printk(KERN_WARNING |
51 | "fsm(%s): init_fsm: Couldn't alloc jumptable\n", name); | 48 | "fsm(%s): init_fsm: Couldn't alloc jumptable\n", name); |
52 | kfree_fsm(this); | 49 | kfree_fsm(this); |
53 | return NULL; | 50 | return NULL; |
54 | } | 51 | } |
55 | memset(m, 0, sizeof(fsm_function_t) * f->nr_states * f->nr_events); | ||
56 | f->jumpmatrix = m; | 52 | f->jumpmatrix = m; |
57 | 53 | ||
58 | for (i = 0; i < tmpl_len; i++) { | 54 | for (i = 0; i < tmpl_len; i++) { |
diff --git a/drivers/s390/net/iucv.c b/drivers/s390/net/iucv.c index 760e77ec5a11..6190be9dca99 100644 --- a/drivers/s390/net/iucv.c +++ b/drivers/s390/net/iucv.c | |||
@@ -386,7 +386,7 @@ iucv_init(void) | |||
386 | } | 386 | } |
387 | 387 | ||
388 | /* Note: GFP_DMA used used to get memory below 2G */ | 388 | /* Note: GFP_DMA used used to get memory below 2G */ |
389 | iucv_external_int_buffer = kmalloc(sizeof(iucv_GeneralInterrupt), | 389 | iucv_external_int_buffer = kzalloc(sizeof(iucv_GeneralInterrupt), |
390 | GFP_KERNEL|GFP_DMA); | 390 | GFP_KERNEL|GFP_DMA); |
391 | if (!iucv_external_int_buffer) { | 391 | if (!iucv_external_int_buffer) { |
392 | printk(KERN_WARNING | 392 | printk(KERN_WARNING |
@@ -396,10 +396,9 @@ iucv_init(void) | |||
396 | bus_unregister(&iucv_bus); | 396 | bus_unregister(&iucv_bus); |
397 | return -ENOMEM; | 397 | return -ENOMEM; |
398 | } | 398 | } |
399 | memset(iucv_external_int_buffer, 0, sizeof(iucv_GeneralInterrupt)); | ||
400 | 399 | ||
401 | /* Initialize parameter pool */ | 400 | /* Initialize parameter pool */ |
402 | iucv_param_pool = kmalloc(sizeof(iucv_param) * PARAM_POOL_SIZE, | 401 | iucv_param_pool = kzalloc(sizeof(iucv_param) * PARAM_POOL_SIZE, |
403 | GFP_KERNEL|GFP_DMA); | 402 | GFP_KERNEL|GFP_DMA); |
404 | if (!iucv_param_pool) { | 403 | if (!iucv_param_pool) { |
405 | printk(KERN_WARNING "%s: Could not allocate param pool\n", | 404 | printk(KERN_WARNING "%s: Could not allocate param pool\n", |
@@ -410,7 +409,6 @@ iucv_init(void) | |||
410 | bus_unregister(&iucv_bus); | 409 | bus_unregister(&iucv_bus); |
411 | return -ENOMEM; | 410 | return -ENOMEM; |
412 | } | 411 | } |
413 | memset(iucv_param_pool, 0, sizeof(iucv_param) * PARAM_POOL_SIZE); | ||
414 | 412 | ||
415 | /* Initialize irq queue */ | 413 | /* Initialize irq queue */ |
416 | INIT_LIST_HEAD(&iucv_irq_queue); | 414 | INIT_LIST_HEAD(&iucv_irq_queue); |
@@ -793,15 +791,14 @@ iucv_register_program (__u8 pgmname[16], | |||
793 | } | 791 | } |
794 | 792 | ||
795 | max_connections = iucv_query_maxconn(); | 793 | max_connections = iucv_query_maxconn(); |
796 | iucv_pathid_table = kmalloc(max_connections * sizeof(handler *), | 794 | iucv_pathid_table = kcalloc(max_connections, sizeof(handler *), |
797 | GFP_ATOMIC); | 795 | GFP_ATOMIC); |
798 | if (iucv_pathid_table == NULL) { | 796 | if (iucv_pathid_table == NULL) { |
799 | printk(KERN_WARNING "%s: iucv_pathid_table storage " | 797 | printk(KERN_WARNING "%s: iucv_pathid_table storage " |
800 | "allocation failed\n", __FUNCTION__); | 798 | "allocation failed\n", __FUNCTION__); |
801 | kfree(new_handler); | 799 | kfree(new_handler); |
802 | return NULL; | 800 | return NULL; |
803 | } | 801 | } |
804 | memset (iucv_pathid_table, 0, max_connections * sizeof(handler *)); | ||
805 | } | 802 | } |
806 | memset(new_handler, 0, sizeof (handler)); | 803 | memset(new_handler, 0, sizeof (handler)); |
807 | memcpy(new_handler->id.user_data, pgmname, | 804 | memcpy(new_handler->id.user_data, pgmname, |
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c index 9cf88d7201d3..edcf05d5d568 100644 --- a/drivers/s390/net/lcs.c +++ b/drivers/s390/net/lcs.c | |||
@@ -115,11 +115,10 @@ lcs_alloc_channel(struct lcs_channel *channel) | |||
115 | LCS_DBF_TEXT(2, setup, "ichalloc"); | 115 | LCS_DBF_TEXT(2, setup, "ichalloc"); |
116 | for (cnt = 0; cnt < LCS_NUM_BUFFS; cnt++) { | 116 | for (cnt = 0; cnt < LCS_NUM_BUFFS; cnt++) { |
117 | /* alloc memory fo iobuffer */ | 117 | /* alloc memory fo iobuffer */ |
118 | channel->iob[cnt].data = (void *) | 118 | channel->iob[cnt].data = |
119 | kmalloc(LCS_IOBUFFERSIZE, GFP_DMA | GFP_KERNEL); | 119 | kzalloc(LCS_IOBUFFERSIZE, GFP_DMA | GFP_KERNEL); |
120 | if (channel->iob[cnt].data == NULL) | 120 | if (channel->iob[cnt].data == NULL) |
121 | break; | 121 | break; |
122 | memset(channel->iob[cnt].data, 0, LCS_IOBUFFERSIZE); | ||
123 | channel->iob[cnt].state = BUF_STATE_EMPTY; | 122 | channel->iob[cnt].state = BUF_STATE_EMPTY; |
124 | } | 123 | } |
125 | if (cnt < LCS_NUM_BUFFS) { | 124 | if (cnt < LCS_NUM_BUFFS) { |
@@ -182,10 +181,9 @@ lcs_alloc_card(void) | |||
182 | 181 | ||
183 | LCS_DBF_TEXT(2, setup, "alloclcs"); | 182 | LCS_DBF_TEXT(2, setup, "alloclcs"); |
184 | 183 | ||
185 | card = kmalloc(sizeof(struct lcs_card), GFP_KERNEL | GFP_DMA); | 184 | card = kzalloc(sizeof(struct lcs_card), GFP_KERNEL | GFP_DMA); |
186 | if (card == NULL) | 185 | if (card == NULL) |
187 | return NULL; | 186 | return NULL; |
188 | memset(card, 0, sizeof(struct lcs_card)); | ||
189 | card->lan_type = LCS_FRAME_TYPE_AUTO; | 187 | card->lan_type = LCS_FRAME_TYPE_AUTO; |
190 | card->pkt_seq = 0; | 188 | card->pkt_seq = 0; |
191 | card->lancmd_timeout = LCS_LANCMD_TIMEOUT_DEFAULT; | 189 | card->lancmd_timeout = LCS_LANCMD_TIMEOUT_DEFAULT; |
@@ -793,10 +791,9 @@ lcs_alloc_reply(struct lcs_cmd *cmd) | |||
793 | 791 | ||
794 | LCS_DBF_TEXT(4, trace, "getreply"); | 792 | LCS_DBF_TEXT(4, trace, "getreply"); |
795 | 793 | ||
796 | reply = kmalloc(sizeof(struct lcs_reply), GFP_ATOMIC); | 794 | reply = kzalloc(sizeof(struct lcs_reply), GFP_ATOMIC); |
797 | if (!reply) | 795 | if (!reply) |
798 | return NULL; | 796 | return NULL; |
799 | memset(reply,0,sizeof(struct lcs_reply)); | ||
800 | atomic_set(&reply->refcnt,1); | 797 | atomic_set(&reply->refcnt,1); |
801 | reply->sequence_no = cmd->sequence_no; | 798 | reply->sequence_no = cmd->sequence_no; |
802 | reply->received = 0; | 799 | reply->received = 0; |
diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c index 71d3853e8682..260a93c8c442 100644 --- a/drivers/s390/net/netiucv.c +++ b/drivers/s390/net/netiucv.c | |||
@@ -1728,14 +1728,13 @@ static int | |||
1728 | netiucv_register_device(struct net_device *ndev) | 1728 | netiucv_register_device(struct net_device *ndev) |
1729 | { | 1729 | { |
1730 | struct netiucv_priv *priv = ndev->priv; | 1730 | struct netiucv_priv *priv = ndev->priv; |
1731 | struct device *dev = kmalloc(sizeof(struct device), GFP_KERNEL); | 1731 | struct device *dev = kzalloc(sizeof(struct device), GFP_KERNEL); |
1732 | int ret; | 1732 | int ret; |
1733 | 1733 | ||
1734 | 1734 | ||
1735 | IUCV_DBF_TEXT(trace, 3, __FUNCTION__); | 1735 | IUCV_DBF_TEXT(trace, 3, __FUNCTION__); |
1736 | 1736 | ||
1737 | if (dev) { | 1737 | if (dev) { |
1738 | memset(dev, 0, sizeof(struct device)); | ||
1739 | snprintf(dev->bus_id, BUS_ID_SIZE, "net%s", ndev->name); | 1738 | snprintf(dev->bus_id, BUS_ID_SIZE, "net%s", ndev->name); |
1740 | dev->bus = &iucv_bus; | 1739 | dev->bus = &iucv_bus; |
1741 | dev->parent = iucv_root; | 1740 | dev->parent = iucv_root; |
@@ -1784,11 +1783,9 @@ netiucv_new_connection(struct net_device *dev, char *username) | |||
1784 | { | 1783 | { |
1785 | struct iucv_connection **clist = &iucv_connections; | 1784 | struct iucv_connection **clist = &iucv_connections; |
1786 | struct iucv_connection *conn = | 1785 | struct iucv_connection *conn = |
1787 | (struct iucv_connection *) | 1786 | kzalloc(sizeof(struct iucv_connection), GFP_KERNEL); |
1788 | kmalloc(sizeof(struct iucv_connection), GFP_KERNEL); | ||
1789 | 1787 | ||
1790 | if (conn) { | 1788 | if (conn) { |
1791 | memset(conn, 0, sizeof(struct iucv_connection)); | ||
1792 | skb_queue_head_init(&conn->collect_queue); | 1789 | skb_queue_head_init(&conn->collect_queue); |
1793 | skb_queue_head_init(&conn->commit_queue); | 1790 | skb_queue_head_init(&conn->commit_queue); |
1794 | conn->max_buffsize = NETIUCV_BUFSIZE_DEFAULT; | 1791 | conn->max_buffsize = NETIUCV_BUFSIZE_DEFAULT; |
diff --git a/drivers/s390/net/qeth_eddp.c b/drivers/s390/net/qeth_eddp.c index 82cb4af2f0e7..44e226f211e7 100644 --- a/drivers/s390/net/qeth_eddp.c +++ b/drivers/s390/net/qeth_eddp.c | |||
@@ -389,9 +389,8 @@ qeth_eddp_create_eddp_data(struct qeth_hdr *qh, u8 *nh, u8 nhl, u8 *th, u8 thl) | |||
389 | struct qeth_eddp_data *eddp; | 389 | struct qeth_eddp_data *eddp; |
390 | 390 | ||
391 | QETH_DBF_TEXT(trace, 5, "eddpcrda"); | 391 | QETH_DBF_TEXT(trace, 5, "eddpcrda"); |
392 | eddp = kmalloc(sizeof(struct qeth_eddp_data), GFP_ATOMIC); | 392 | eddp = kzalloc(sizeof(struct qeth_eddp_data), GFP_ATOMIC); |
393 | if (eddp){ | 393 | if (eddp){ |
394 | memset(eddp, 0, sizeof(struct qeth_eddp_data)); | ||
395 | eddp->nhl = nhl; | 394 | eddp->nhl = nhl; |
396 | eddp->thl = thl; | 395 | eddp->thl = thl; |
397 | memcpy(&eddp->qh, qh, sizeof(struct qeth_hdr)); | 396 | memcpy(&eddp->qh, qh, sizeof(struct qeth_hdr)); |
@@ -542,12 +541,11 @@ qeth_eddp_create_context_generic(struct qeth_card *card, struct sk_buff *skb, | |||
542 | 541 | ||
543 | QETH_DBF_TEXT(trace, 5, "creddpcg"); | 542 | QETH_DBF_TEXT(trace, 5, "creddpcg"); |
544 | /* create the context and allocate pages */ | 543 | /* create the context and allocate pages */ |
545 | ctx = kmalloc(sizeof(struct qeth_eddp_context), GFP_ATOMIC); | 544 | ctx = kzalloc(sizeof(struct qeth_eddp_context), GFP_ATOMIC); |
546 | if (ctx == NULL){ | 545 | if (ctx == NULL){ |
547 | QETH_DBF_TEXT(trace, 2, "ceddpcn1"); | 546 | QETH_DBF_TEXT(trace, 2, "ceddpcn1"); |
548 | return NULL; | 547 | return NULL; |
549 | } | 548 | } |
550 | memset(ctx, 0, sizeof(struct qeth_eddp_context)); | ||
551 | ctx->type = QETH_LARGE_SEND_EDDP; | 549 | ctx->type = QETH_LARGE_SEND_EDDP; |
552 | qeth_eddp_calc_num_pages(ctx, skb, hdr_len); | 550 | qeth_eddp_calc_num_pages(ctx, skb, hdr_len); |
553 | if (ctx->elements_per_skb > QETH_MAX_BUFFER_ELEMENTS(card)){ | 551 | if (ctx->elements_per_skb > QETH_MAX_BUFFER_ELEMENTS(card)){ |
@@ -555,13 +553,12 @@ qeth_eddp_create_context_generic(struct qeth_card *card, struct sk_buff *skb, | |||
555 | kfree(ctx); | 553 | kfree(ctx); |
556 | return NULL; | 554 | return NULL; |
557 | } | 555 | } |
558 | ctx->pages = kmalloc(ctx->num_pages * sizeof(u8 *), GFP_ATOMIC); | 556 | ctx->pages = kcalloc(ctx->num_pages, sizeof(u8 *), GFP_ATOMIC); |
559 | if (ctx->pages == NULL){ | 557 | if (ctx->pages == NULL){ |
560 | QETH_DBF_TEXT(trace, 2, "ceddpcn2"); | 558 | QETH_DBF_TEXT(trace, 2, "ceddpcn2"); |
561 | kfree(ctx); | 559 | kfree(ctx); |
562 | return NULL; | 560 | return NULL; |
563 | } | 561 | } |
564 | memset(ctx->pages, 0, ctx->num_pages * sizeof(u8 *)); | ||
565 | for (i = 0; i < ctx->num_pages; ++i){ | 562 | for (i = 0; i < ctx->num_pages; ++i){ |
566 | addr = (u8 *)__get_free_page(GFP_ATOMIC); | 563 | addr = (u8 *)__get_free_page(GFP_ATOMIC); |
567 | if (addr == NULL){ | 564 | if (addr == NULL){ |
@@ -573,15 +570,13 @@ qeth_eddp_create_context_generic(struct qeth_card *card, struct sk_buff *skb, | |||
573 | memset(addr, 0, PAGE_SIZE); | 570 | memset(addr, 0, PAGE_SIZE); |
574 | ctx->pages[i] = addr; | 571 | ctx->pages[i] = addr; |
575 | } | 572 | } |
576 | ctx->elements = kmalloc(ctx->num_elements * | 573 | ctx->elements = kcalloc(ctx->num_elements, |
577 | sizeof(struct qeth_eddp_element), GFP_ATOMIC); | 574 | sizeof(struct qeth_eddp_element), GFP_ATOMIC); |
578 | if (ctx->elements == NULL){ | 575 | if (ctx->elements == NULL){ |
579 | QETH_DBF_TEXT(trace, 2, "ceddpcn4"); | 576 | QETH_DBF_TEXT(trace, 2, "ceddpcn4"); |
580 | qeth_eddp_free_context(ctx); | 577 | qeth_eddp_free_context(ctx); |
581 | return NULL; | 578 | return NULL; |
582 | } | 579 | } |
583 | memset(ctx->elements, 0, | ||
584 | ctx->num_elements * sizeof(struct qeth_eddp_element)); | ||
585 | /* reset num_elements; will be incremented again in fill_buffer to | 580 | /* reset num_elements; will be incremented again in fill_buffer to |
586 | * reflect number of actually used elements */ | 581 | * reflect number of actually used elements */ |
587 | ctx->num_elements = 0; | 582 | ctx->num_elements = 0; |
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index 021cd5d08c61..b3c6e7907790 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c | |||
@@ -297,12 +297,10 @@ qeth_alloc_card(void) | |||
297 | struct qeth_card *card; | 297 | struct qeth_card *card; |
298 | 298 | ||
299 | QETH_DBF_TEXT(setup, 2, "alloccrd"); | 299 | QETH_DBF_TEXT(setup, 2, "alloccrd"); |
300 | card = (struct qeth_card *) kmalloc(sizeof(struct qeth_card), | 300 | card = kzalloc(sizeof(struct qeth_card), GFP_DMA|GFP_KERNEL); |
301 | GFP_DMA|GFP_KERNEL); | ||
302 | if (!card) | 301 | if (!card) |
303 | return NULL; | 302 | return NULL; |
304 | QETH_DBF_HEX(setup, 2, &card, sizeof(void *)); | 303 | QETH_DBF_HEX(setup, 2, &card, sizeof(void *)); |
305 | memset(card, 0, sizeof(struct qeth_card)); | ||
306 | if (qeth_setup_channel(&card->read)) { | 304 | if (qeth_setup_channel(&card->read)) { |
307 | kfree(card); | 305 | kfree(card); |
308 | return NULL; | 306 | return NULL; |
@@ -1632,9 +1630,8 @@ qeth_alloc_reply(struct qeth_card *card) | |||
1632 | { | 1630 | { |
1633 | struct qeth_reply *reply; | 1631 | struct qeth_reply *reply; |
1634 | 1632 | ||
1635 | reply = kmalloc(sizeof(struct qeth_reply), GFP_ATOMIC); | 1633 | reply = kzalloc(sizeof(struct qeth_reply), GFP_ATOMIC); |
1636 | if (reply){ | 1634 | if (reply){ |
1637 | memset(reply, 0, sizeof(struct qeth_reply)); | ||
1638 | atomic_set(&reply->refcnt, 1); | 1635 | atomic_set(&reply->refcnt, 1); |
1639 | reply->card = card; | 1636 | reply->card = card; |
1640 | }; | 1637 | }; |
@@ -3348,13 +3345,11 @@ qeth_qdio_establish(struct qeth_card *card) | |||
3348 | 3345 | ||
3349 | QETH_DBF_TEXT(setup, 2, "qdioest"); | 3346 | QETH_DBF_TEXT(setup, 2, "qdioest"); |
3350 | 3347 | ||
3351 | qib_param_field = kmalloc(QDIO_MAX_BUFFERS_PER_Q * sizeof(char), | 3348 | qib_param_field = kzalloc(QDIO_MAX_BUFFERS_PER_Q * sizeof(char), |
3352 | GFP_KERNEL); | 3349 | GFP_KERNEL); |
3353 | if (!qib_param_field) | 3350 | if (!qib_param_field) |
3354 | return -ENOMEM; | 3351 | return -ENOMEM; |
3355 | 3352 | ||
3356 | memset(qib_param_field, 0, QDIO_MAX_BUFFERS_PER_Q * sizeof(char)); | ||
3357 | |||
3358 | qeth_create_qib_param_field(card, qib_param_field); | 3353 | qeth_create_qib_param_field(card, qib_param_field); |
3359 | qeth_create_qib_param_field_blkt(card, qib_param_field); | 3354 | qeth_create_qib_param_field_blkt(card, qib_param_field); |
3360 | 3355 | ||
@@ -4819,9 +4814,8 @@ qeth_arp_query(struct qeth_card *card, char *udata) | |||
4819 | /* get size of userspace buffer and mask_bits -> 6 bytes */ | 4814 | /* get size of userspace buffer and mask_bits -> 6 bytes */ |
4820 | if (copy_from_user(&qinfo, udata, 6)) | 4815 | if (copy_from_user(&qinfo, udata, 6)) |
4821 | return -EFAULT; | 4816 | return -EFAULT; |
4822 | if (!(qinfo.udata = kmalloc(qinfo.udata_len, GFP_KERNEL))) | 4817 | if (!(qinfo.udata = kzalloc(qinfo.udata_len, GFP_KERNEL))) |
4823 | return -ENOMEM; | 4818 | return -ENOMEM; |
4824 | memset(qinfo.udata, 0, qinfo.udata_len); | ||
4825 | qinfo.udata_offset = QETH_QARP_ENTRIES_OFFSET; | 4819 | qinfo.udata_offset = QETH_QARP_ENTRIES_OFFSET; |
4826 | iob = qeth_get_setassparms_cmd(card, IPA_ARP_PROCESSING, | 4820 | iob = qeth_get_setassparms_cmd(card, IPA_ARP_PROCESSING, |
4827 | IPA_CMD_ASS_ARP_QUERY_INFO, | 4821 | IPA_CMD_ASS_ARP_QUERY_INFO, |
@@ -4969,11 +4963,10 @@ qeth_snmp_command(struct qeth_card *card, char *udata) | |||
4969 | return -EFAULT; | 4963 | return -EFAULT; |
4970 | } | 4964 | } |
4971 | qinfo.udata_len = ureq->hdr.data_len; | 4965 | qinfo.udata_len = ureq->hdr.data_len; |
4972 | if (!(qinfo.udata = kmalloc(qinfo.udata_len, GFP_KERNEL))){ | 4966 | if (!(qinfo.udata = kzalloc(qinfo.udata_len, GFP_KERNEL))){ |
4973 | kfree(ureq); | 4967 | kfree(ureq); |
4974 | return -ENOMEM; | 4968 | return -ENOMEM; |
4975 | } | 4969 | } |
4976 | memset(qinfo.udata, 0, qinfo.udata_len); | ||
4977 | qinfo.udata_offset = sizeof(struct qeth_snmp_ureq_hdr); | 4970 | qinfo.udata_offset = sizeof(struct qeth_snmp_ureq_hdr); |
4978 | 4971 | ||
4979 | iob = qeth_get_adapter_cmd(card, IPA_SETADP_SET_SNMP_CONTROL, | 4972 | iob = qeth_get_adapter_cmd(card, IPA_SETADP_SET_SNMP_CONTROL, |
@@ -5564,12 +5557,11 @@ qeth_get_addr_buffer(enum qeth_prot_versions prot) | |||
5564 | { | 5557 | { |
5565 | struct qeth_ipaddr *addr; | 5558 | struct qeth_ipaddr *addr; |
5566 | 5559 | ||
5567 | addr = kmalloc(sizeof(struct qeth_ipaddr), GFP_ATOMIC); | 5560 | addr = kzalloc(sizeof(struct qeth_ipaddr), GFP_ATOMIC); |
5568 | if (addr == NULL) { | 5561 | if (addr == NULL) { |
5569 | PRINT_WARN("Not enough memory to add address\n"); | 5562 | PRINT_WARN("Not enough memory to add address\n"); |
5570 | return NULL; | 5563 | return NULL; |
5571 | } | 5564 | } |
5572 | memset(addr,0,sizeof(struct qeth_ipaddr)); | ||
5573 | addr->type = QETH_IP_TYPE_NORMAL; | 5565 | addr->type = QETH_IP_TYPE_NORMAL; |
5574 | addr->proto = prot; | 5566 | addr->proto = prot; |
5575 | return addr; | 5567 | return addr; |
diff --git a/drivers/s390/net/qeth_sys.c b/drivers/s390/net/qeth_sys.c index f2a076a2b2f1..882d419e4160 100644 --- a/drivers/s390/net/qeth_sys.c +++ b/drivers/s390/net/qeth_sys.c | |||
@@ -1145,11 +1145,10 @@ qeth_dev_ipato_add_store(const char *buf, size_t count, | |||
1145 | if ((rc = qeth_parse_ipatoe(buf, proto, addr, &mask_bits))) | 1145 | if ((rc = qeth_parse_ipatoe(buf, proto, addr, &mask_bits))) |
1146 | return rc; | 1146 | return rc; |
1147 | 1147 | ||
1148 | if (!(ipatoe = kmalloc(sizeof(struct qeth_ipato_entry), GFP_KERNEL))){ | 1148 | if (!(ipatoe = kzalloc(sizeof(struct qeth_ipato_entry), GFP_KERNEL))){ |
1149 | PRINT_WARN("No memory to allocate ipato entry\n"); | 1149 | PRINT_WARN("No memory to allocate ipato entry\n"); |
1150 | return -ENOMEM; | 1150 | return -ENOMEM; |
1151 | } | 1151 | } |
1152 | memset(ipatoe, 0, sizeof(struct qeth_ipato_entry)); | ||
1153 | ipatoe->proto = proto; | 1152 | ipatoe->proto = proto; |
1154 | memcpy(ipatoe->addr, addr, (proto == QETH_PROT_IPV4)? 4:16); | 1153 | memcpy(ipatoe->addr, addr, (proto == QETH_PROT_IPV4)? 4:16); |
1155 | ipatoe->mask_bits = mask_bits; | 1154 | ipatoe->mask_bits = mask_bits; |