diff options
Diffstat (limited to 'net/irda')
-rw-r--r-- | net/irda/iriap.c | 11 | ||||
-rw-r--r-- | net/irda/irias_object.c | 4 | ||||
-rw-r--r-- | net/irda/irlan/irlan_common.c | 2 | ||||
-rw-r--r-- | net/irda/irlmp.c | 4 | ||||
-rw-r--r-- | net/irda/irqueue.c | 3 | ||||
-rw-r--r-- | net/irda/irttp.c | 4 |
6 files changed, 11 insertions, 17 deletions
diff --git a/net/irda/iriap.c b/net/irda/iriap.c index 415cf4eec23b..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; |
@@ -451,12 +450,12 @@ static void iriap_getvaluebyclass_confirm(struct iriap_cb *self, | |||
451 | n = 2; | 450 | n = 2; |
452 | 451 | ||
453 | /* Get length, MSB first */ | 452 | /* Get length, MSB first */ |
454 | len = be16_to_cpu(get_unaligned((__u16 *)(fp+n))); n += 2; | 453 | len = be16_to_cpu(get_unaligned((__be16 *)(fp+n))); n += 2; |
455 | 454 | ||
456 | IRDA_DEBUG(4, "%s(), len=%d\n", __FUNCTION__, len); | 455 | IRDA_DEBUG(4, "%s(), len=%d\n", __FUNCTION__, len); |
457 | 456 | ||
458 | /* Get object ID, MSB first */ | 457 | /* Get object ID, MSB first */ |
459 | obj_id = be16_to_cpu(get_unaligned((__u16 *)(fp+n))); n += 2; | 458 | obj_id = be16_to_cpu(get_unaligned((__be16 *)(fp+n))); n += 2; |
460 | 459 | ||
461 | type = fp[n++]; | 460 | type = fp[n++]; |
462 | IRDA_DEBUG(4, "%s(), Value type = %d\n", __FUNCTION__, type); | 461 | IRDA_DEBUG(4, "%s(), Value type = %d\n", __FUNCTION__, type); |
@@ -506,7 +505,7 @@ static void iriap_getvaluebyclass_confirm(struct iriap_cb *self, | |||
506 | value = irias_new_string_value(fp+n); | 505 | value = irias_new_string_value(fp+n); |
507 | break; | 506 | break; |
508 | case IAS_OCT_SEQ: | 507 | case IAS_OCT_SEQ: |
509 | value_len = be16_to_cpu(get_unaligned((__u16 *)(fp+n))); | 508 | value_len = be16_to_cpu(get_unaligned((__be16 *)(fp+n))); |
510 | n += 2; | 509 | n += 2; |
511 | 510 | ||
512 | /* Will truncate to IAS_MAX_OCTET_STRING bytes */ | 511 | /* Will truncate to IAS_MAX_OCTET_STRING bytes */ |
@@ -544,7 +543,7 @@ static void iriap_getvaluebyclass_response(struct iriap_cb *self, | |||
544 | { | 543 | { |
545 | struct sk_buff *tx_skb; | 544 | struct sk_buff *tx_skb; |
546 | int n; | 545 | int n; |
547 | __u32 tmp_be32; | 546 | __be32 tmp_be32; |
548 | __be16 tmp_be16; | 547 | __be16 tmp_be16; |
549 | __u8 *fp; | 548 | __u8 *fp; |
550 | 549 | ||
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/irlan/irlan_common.c b/net/irda/irlan/irlan_common.c index 9b962f247714..2bb04ac09329 100644 --- a/net/irda/irlan/irlan_common.c +++ b/net/irda/irlan/irlan_common.c | |||
@@ -995,7 +995,7 @@ static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, | |||
995 | { | 995 | { |
996 | __u8 *frame; | 996 | __u8 *frame; |
997 | __u8 param_len; | 997 | __u8 param_len; |
998 | __u16 tmp_le; /* Temporary value in little endian format */ | 998 | __le16 tmp_le; /* Temporary value in little endian format */ |
999 | int n=0; | 999 | int n=0; |
1000 | 1000 | ||
1001 | if (skb == NULL) { | 1001 | if (skb == NULL) { |
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; |
diff --git a/net/irda/irttp.c b/net/irda/irttp.c index 3c2e70b77df1..9c446a72ff1f 100644 --- a/net/irda/irttp.c +++ b/net/irda/irttp.c | |||
@@ -1147,7 +1147,7 @@ int irttp_connect_request(struct tsap_cb *self, __u8 dtsap_sel, | |||
1147 | frame[3] = 0x02; /* Value length */ | 1147 | frame[3] = 0x02; /* Value length */ |
1148 | 1148 | ||
1149 | put_unaligned(cpu_to_be16((__u16) max_sdu_size), | 1149 | put_unaligned(cpu_to_be16((__u16) max_sdu_size), |
1150 | (__u16 *)(frame+4)); | 1150 | (__be16 *)(frame+4)); |
1151 | } else { | 1151 | } else { |
1152 | /* Insert plain TTP header */ | 1152 | /* Insert plain TTP header */ |
1153 | frame = skb_push(tx_skb, TTP_HEADER); | 1153 | frame = skb_push(tx_skb, TTP_HEADER); |
@@ -1394,7 +1394,7 @@ int irttp_connect_response(struct tsap_cb *self, __u32 max_sdu_size, | |||
1394 | frame[3] = 0x02; /* Value length */ | 1394 | frame[3] = 0x02; /* Value length */ |
1395 | 1395 | ||
1396 | put_unaligned(cpu_to_be16((__u16) max_sdu_size), | 1396 | put_unaligned(cpu_to_be16((__u16) max_sdu_size), |
1397 | (__u16 *)(frame+4)); | 1397 | (__be16 *)(frame+4)); |
1398 | } else { | 1398 | } else { |
1399 | /* Insert TTP header */ | 1399 | /* Insert TTP header */ |
1400 | frame = skb_push(tx_skb, TTP_HEADER); | 1400 | frame = skb_push(tx_skb, TTP_HEADER); |