aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/irda/iriap.c3
-rw-r--r--net/irda/irias_object.c4
-rw-r--r--net/irda/irlmp.c4
-rw-r--r--net/irda/irqueue.c3
4 files changed, 4 insertions, 10 deletions
diff --git a/net/irda/iriap.c b/net/irda/iriap.c
index ab86d70393ea..8cfd076c4c12 100644
--- a/net/irda/iriap.c
+++ b/net/irda/iriap.c
@@ -172,7 +172,7 @@ struct iriap_cb *iriap_open(__u8 slsap_sel, int mode, void *priv,
172 172
173 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 173 IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
174 174
175 self = kmalloc(sizeof(struct iriap_cb), GFP_ATOMIC); 175 self = kzalloc(sizeof(*self), GFP_ATOMIC);
176 if (!self) { 176 if (!self) {
177 IRDA_WARNING("%s: Unable to kmalloc!\n", __FUNCTION__); 177 IRDA_WARNING("%s: Unable to kmalloc!\n", __FUNCTION__);
178 return NULL; 178 return NULL;
@@ -181,7 +181,6 @@ struct iriap_cb *iriap_open(__u8 slsap_sel, int mode, void *priv,
181 /* 181 /*
182 * Initialize instance 182 * Initialize instance
183 */ 183 */
184 memset(self, 0, sizeof(struct iriap_cb));
185 184
186 self->magic = IAS_MAGIC; 185 self->magic = IAS_MAGIC;
187 self->mode = mode; 186 self->mode = mode;
diff --git a/net/irda/irias_object.c b/net/irda/irias_object.c
index 56292ab7d652..b1ee99a59c0c 100644
--- a/net/irda/irias_object.c
+++ b/net/irda/irias_object.c
@@ -501,13 +501,12 @@ struct ias_value *irias_new_octseq_value(__u8 *octseq , int len)
501 len = IAS_MAX_OCTET_STRING; 501 len = IAS_MAX_OCTET_STRING;
502 value->len = len; 502 value->len = len;
503 503
504 value->t.oct_seq = kmalloc(len, GFP_ATOMIC); 504 value->t.oct_seq = kmemdup(octseq, len, GFP_ATOMIC);
505 if (value->t.oct_seq == NULL){ 505 if (value->t.oct_seq == NULL){
506 IRDA_WARNING("%s: Unable to kmalloc!\n", __FUNCTION__); 506 IRDA_WARNING("%s: Unable to kmalloc!\n", __FUNCTION__);
507 kfree(value); 507 kfree(value);
508 return NULL; 508 return NULL;
509 } 509 }
510 memcpy(value->t.oct_seq, octseq , len);
511 return value; 510 return value;
512} 511}
513 512
@@ -522,7 +521,6 @@ struct ias_value *irias_new_missing_value(void)
522 } 521 }
523 522
524 value->type = IAS_MISSING; 523 value->type = IAS_MISSING;
525 value->len = 0;
526 524
527 return value; 525 return value;
528} 526}
diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c
index fede83763095..7e5d12ab3b90 100644
--- a/net/irda/irlmp.c
+++ b/net/irda/irlmp.c
@@ -641,15 +641,13 @@ struct lsap_cb *irlmp_dup(struct lsap_cb *orig, void *instance)
641 } 641 }
642 642
643 /* Allocate a new instance */ 643 /* Allocate a new instance */
644 new = kmalloc(sizeof(struct lsap_cb), GFP_ATOMIC); 644 new = kmemdup(orig, sizeof(*new), GFP_ATOMIC);
645 if (!new) { 645 if (!new) {
646 IRDA_DEBUG(0, "%s(), unable to kmalloc\n", __FUNCTION__); 646 IRDA_DEBUG(0, "%s(), unable to kmalloc\n", __FUNCTION__);
647 spin_unlock_irqrestore(&irlmp->unconnected_lsaps->hb_spinlock, 647 spin_unlock_irqrestore(&irlmp->unconnected_lsaps->hb_spinlock,
648 flags); 648 flags);
649 return NULL; 649 return NULL;
650 } 650 }
651 /* Dup */
652 memcpy(new, orig, sizeof(struct lsap_cb));
653 /* new->lap = orig->lap; => done in the memcpy() */ 651 /* new->lap = orig->lap; => done in the memcpy() */
654 /* new->slsap_sel = orig->slsap_sel; => done in the memcpy() */ 652 /* new->slsap_sel = orig->slsap_sel; => done in the memcpy() */
655 new->conn_skb = NULL; 653 new->conn_skb = NULL;
diff --git a/net/irda/irqueue.c b/net/irda/irqueue.c
index 1ba8c7106639..1d26cd33ea13 100644
--- a/net/irda/irqueue.c
+++ b/net/irda/irqueue.c
@@ -356,14 +356,13 @@ hashbin_t *hashbin_new(int type)
356 /* 356 /*
357 * Allocate new hashbin 357 * Allocate new hashbin
358 */ 358 */
359 hashbin = kmalloc( sizeof(hashbin_t), GFP_ATOMIC); 359 hashbin = kzalloc(sizeof(*hashbin), GFP_ATOMIC);
360 if (!hashbin) 360 if (!hashbin)
361 return NULL; 361 return NULL;
362 362
363 /* 363 /*
364 * Initialize structure 364 * Initialize structure
365 */ 365 */
366 memset(hashbin, 0, sizeof(hashbin_t));
367 hashbin->hb_type = type; 366 hashbin->hb_type = type;
368 hashbin->magic = HB_MAGIC; 367 hashbin->magic = HB_MAGIC;
369 //hashbin->hb_current = NULL; 368 //hashbin->hb_current = NULL;