diff options
Diffstat (limited to 'net/tipc/msg.h')
-rw-r--r-- | net/tipc/msg.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/net/tipc/msg.h b/net/tipc/msg.h index 62d549063604..35d5ba1d4f42 100644 --- a/net/tipc/msg.h +++ b/net/tipc/msg.h | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * net/tipc/msg.h: Include file for TIPC message header routines | 2 | * net/tipc/msg.h: Include file for TIPC message header routines |
3 | * | 3 | * |
4 | * Copyright (c) 2000-2006, Ericsson AB | 4 | * Copyright (c) 2000-2007, Ericsson AB |
5 | * Copyright (c) 2005, Wind River Systems | 5 | * Copyright (c) 2005-2007, Wind River Systems |
6 | * All rights reserved. | 6 | * All rights reserved. |
7 | * | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
@@ -71,8 +71,11 @@ static inline void msg_set_word(struct tipc_msg *m, u32 w, u32 val) | |||
71 | static inline void msg_set_bits(struct tipc_msg *m, u32 w, | 71 | static inline void msg_set_bits(struct tipc_msg *m, u32 w, |
72 | u32 pos, u32 mask, u32 val) | 72 | u32 pos, u32 mask, u32 val) |
73 | { | 73 | { |
74 | u32 word = msg_word(m,w) & ~(mask << pos); | 74 | val = (val & mask) << pos; |
75 | msg_set_word(m, w, (word |= (val << pos))); | 75 | val = htonl(val); |
76 | mask = htonl(mask << pos); | ||
77 | m->hdr[w] &= ~mask; | ||
78 | m->hdr[w] |= val; | ||
76 | } | 79 | } |
77 | 80 | ||
78 | /* | 81 | /* |
@@ -786,15 +789,16 @@ static inline int msg_build(struct tipc_msg *hdr, | |||
786 | *buf = buf_acquire(sz); | 789 | *buf = buf_acquire(sz); |
787 | if (!(*buf)) | 790 | if (!(*buf)) |
788 | return -ENOMEM; | 791 | return -ENOMEM; |
789 | memcpy((*buf)->data, (unchar *)hdr, hsz); | 792 | skb_copy_to_linear_data(*buf, hdr, hsz); |
790 | for (res = 1, cnt = 0; res && (cnt < num_sect); cnt++) { | 793 | for (res = 1, cnt = 0; res && (cnt < num_sect); cnt++) { |
791 | if (likely(usrmem)) | 794 | if (likely(usrmem)) |
792 | res = !copy_from_user((*buf)->data + pos, | 795 | res = !copy_from_user((*buf)->data + pos, |
793 | msg_sect[cnt].iov_base, | 796 | msg_sect[cnt].iov_base, |
794 | msg_sect[cnt].iov_len); | 797 | msg_sect[cnt].iov_len); |
795 | else | 798 | else |
796 | memcpy((*buf)->data + pos, msg_sect[cnt].iov_base, | 799 | skb_copy_to_linear_data_offset(*buf, pos, |
797 | msg_sect[cnt].iov_len); | 800 | msg_sect[cnt].iov_base, |
801 | msg_sect[cnt].iov_len); | ||
798 | pos += msg_sect[cnt].iov_len; | 802 | pos += msg_sect[cnt].iov_len; |
799 | } | 803 | } |
800 | if (likely(res)) | 804 | if (likely(res)) |