diff options
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/auth_gss/auth_gss.c | 3 | ||||
-rw-r--r-- | net/sunrpc/auth_gss/gss_krb5_mech.c | 3 | ||||
-rw-r--r-- | net/sunrpc/auth_gss/gss_spkm3_mech.c | 3 | ||||
-rw-r--r-- | net/sunrpc/auth_gss/svcauth_gss.c | 7 | ||||
-rw-r--r-- | net/sunrpc/clnt.c | 3 | ||||
-rw-r--r-- | net/sunrpc/socklib.c | 7 | ||||
-rw-r--r-- | net/sunrpc/svcauth_unix.c | 8 |
7 files changed, 14 insertions, 20 deletions
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index b36b9463f5a4..e5a84a482e57 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -198,11 +198,10 @@ simple_get_netobj(const void *p, const void *end, struct xdr_netobj *dest) | |||
198 | q = (const void *)((const char *)p + len); | 198 | q = (const void *)((const char *)p + len); |
199 | if (unlikely(q > end || q < p)) | 199 | if (unlikely(q > end || q < p)) |
200 | return ERR_PTR(-EFAULT); | 200 | return ERR_PTR(-EFAULT); |
201 | dest->data = kmalloc(len, GFP_KERNEL); | 201 | dest->data = kmemdup(p, len, GFP_KERNEL); |
202 | if (unlikely(dest->data == NULL)) | 202 | if (unlikely(dest->data == NULL)) |
203 | return ERR_PTR(-ENOMEM); | 203 | return ERR_PTR(-ENOMEM); |
204 | dest->len = len; | 204 | dest->len = len; |
205 | memcpy(dest->data, p, len); | ||
206 | return q; | 205 | return q; |
207 | } | 206 | } |
208 | 207 | ||
diff --git a/net/sunrpc/auth_gss/gss_krb5_mech.c b/net/sunrpc/auth_gss/gss_krb5_mech.c index 325e72e4fd31..754b8cd6439f 100644 --- a/net/sunrpc/auth_gss/gss_krb5_mech.c +++ b/net/sunrpc/auth_gss/gss_krb5_mech.c | |||
@@ -70,10 +70,9 @@ simple_get_netobj(const void *p, const void *end, struct xdr_netobj *res) | |||
70 | q = (const void *)((const char *)p + len); | 70 | q = (const void *)((const char *)p + len); |
71 | if (unlikely(q > end || q < p)) | 71 | if (unlikely(q > end || q < p)) |
72 | return ERR_PTR(-EFAULT); | 72 | return ERR_PTR(-EFAULT); |
73 | res->data = kmalloc(len, GFP_KERNEL); | 73 | res->data = kmemdup(p, len, GFP_KERNEL); |
74 | if (unlikely(res->data == NULL)) | 74 | if (unlikely(res->data == NULL)) |
75 | return ERR_PTR(-ENOMEM); | 75 | return ERR_PTR(-ENOMEM); |
76 | memcpy(res->data, p, len); | ||
77 | res->len = len; | 76 | res->len = len; |
78 | return q; | 77 | return q; |
79 | } | 78 | } |
diff --git a/net/sunrpc/auth_gss/gss_spkm3_mech.c b/net/sunrpc/auth_gss/gss_spkm3_mech.c index bdedf456bc17..d57f60838895 100644 --- a/net/sunrpc/auth_gss/gss_spkm3_mech.c +++ b/net/sunrpc/auth_gss/gss_spkm3_mech.c | |||
@@ -76,10 +76,9 @@ simple_get_netobj(const void *p, const void *end, struct xdr_netobj *res) | |||
76 | q = (const void *)((const char *)p + len); | 76 | q = (const void *)((const char *)p + len); |
77 | if (unlikely(q > end || q < p)) | 77 | if (unlikely(q > end || q < p)) |
78 | return ERR_PTR(-EFAULT); | 78 | return ERR_PTR(-EFAULT); |
79 | res->data = kmalloc(len, GFP_KERNEL); | 79 | res->data = kmemdup(p, len, GFP_KERNEL); |
80 | if (unlikely(res->data == NULL)) | 80 | if (unlikely(res->data == NULL)) |
81 | return ERR_PTR(-ENOMEM); | 81 | return ERR_PTR(-ENOMEM); |
82 | memcpy(res->data, p, len); | ||
83 | return q; | 82 | return q; |
84 | } | 83 | } |
85 | 84 | ||
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index 1f0f079ffa65..700353b330fd 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c | |||
@@ -113,9 +113,7 @@ static int rsi_match(struct cache_head *a, struct cache_head *b) | |||
113 | static int dup_to_netobj(struct xdr_netobj *dst, char *src, int len) | 113 | static int dup_to_netobj(struct xdr_netobj *dst, char *src, int len) |
114 | { | 114 | { |
115 | dst->len = len; | 115 | dst->len = len; |
116 | dst->data = (len ? kmalloc(len, GFP_KERNEL) : NULL); | 116 | dst->data = (len ? kmemdup(src, len, GFP_KERNEL) : NULL); |
117 | if (dst->data) | ||
118 | memcpy(dst->data, src, len); | ||
119 | if (len && !dst->data) | 117 | if (len && !dst->data) |
120 | return -ENOMEM; | 118 | return -ENOMEM; |
121 | return 0; | 119 | return 0; |
@@ -756,10 +754,9 @@ svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name) | |||
756 | if (!new) | 754 | if (!new) |
757 | goto out; | 755 | goto out; |
758 | kref_init(&new->h.ref); | 756 | kref_init(&new->h.ref); |
759 | new->h.name = kmalloc(strlen(name) + 1, GFP_KERNEL); | 757 | new->h.name = kstrdup(name, GFP_KERNEL); |
760 | if (!new->h.name) | 758 | if (!new->h.name) |
761 | goto out_free_dom; | 759 | goto out_free_dom; |
762 | strcpy(new->h.name, name); | ||
763 | new->h.flavour = &svcauthops_gss; | 760 | new->h.flavour = &svcauthops_gss; |
764 | new->pseudoflavor = pseudoflavor; | 761 | new->pseudoflavor = pseudoflavor; |
765 | 762 | ||
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 78696f2dc7d6..dfeea4fea95a 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -253,10 +253,9 @@ rpc_clone_client(struct rpc_clnt *clnt) | |||
253 | { | 253 | { |
254 | struct rpc_clnt *new; | 254 | struct rpc_clnt *new; |
255 | 255 | ||
256 | new = kmalloc(sizeof(*new), GFP_KERNEL); | 256 | new = kmemdup(clnt, sizeof(*new), GFP_KERNEL); |
257 | if (!new) | 257 | if (!new) |
258 | goto out_no_clnt; | 258 | goto out_no_clnt; |
259 | memcpy(new, clnt, sizeof(*new)); | ||
260 | atomic_set(&new->cl_count, 1); | 259 | atomic_set(&new->cl_count, 1); |
261 | atomic_set(&new->cl_users, 0); | 260 | atomic_set(&new->cl_users, 0); |
262 | new->cl_parent = clnt; | 261 | new->cl_parent = clnt; |
diff --git a/net/sunrpc/socklib.c b/net/sunrpc/socklib.c index 6f17527b9e69..2635c543ba06 100644 --- a/net/sunrpc/socklib.c +++ b/net/sunrpc/socklib.c | |||
@@ -45,7 +45,8 @@ static size_t skb_read_bits(skb_reader_t *desc, void *to, size_t len) | |||
45 | */ | 45 | */ |
46 | static size_t skb_read_and_csum_bits(skb_reader_t *desc, void *to, size_t len) | 46 | static size_t skb_read_and_csum_bits(skb_reader_t *desc, void *to, size_t len) |
47 | { | 47 | { |
48 | unsigned int csum2, pos; | 48 | unsigned int pos; |
49 | __wsum csum2; | ||
49 | 50 | ||
50 | if (len > desc->count) | 51 | if (len > desc->count) |
51 | len = desc->count; | 52 | len = desc->count; |
@@ -160,13 +161,13 @@ int csum_partial_copy_to_xdr(struct xdr_buf *xdr, struct sk_buff *skb) | |||
160 | if (xdr_partial_copy_from_skb(xdr, 0, &desc, skb_read_and_csum_bits) < 0) | 161 | if (xdr_partial_copy_from_skb(xdr, 0, &desc, skb_read_and_csum_bits) < 0) |
161 | return -1; | 162 | return -1; |
162 | if (desc.offset != skb->len) { | 163 | if (desc.offset != skb->len) { |
163 | unsigned int csum2; | 164 | __wsum csum2; |
164 | csum2 = skb_checksum(skb, desc.offset, skb->len - desc.offset, 0); | 165 | csum2 = skb_checksum(skb, desc.offset, skb->len - desc.offset, 0); |
165 | desc.csum = csum_block_add(desc.csum, csum2, desc.offset); | 166 | desc.csum = csum_block_add(desc.csum, csum2, desc.offset); |
166 | } | 167 | } |
167 | if (desc.count) | 168 | if (desc.count) |
168 | return -1; | 169 | return -1; |
169 | if ((unsigned short)csum_fold(desc.csum)) | 170 | if (csum_fold(desc.csum)) |
170 | return -1; | 171 | return -1; |
171 | if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE)) | 172 | if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE)) |
172 | netdev_rx_csum_fault(skb->dev); | 173 | netdev_rx_csum_fault(skb->dev); |
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c index e1bd933629fe..a0a953a430c2 100644 --- a/net/sunrpc/svcauth_unix.c +++ b/net/sunrpc/svcauth_unix.c | |||
@@ -101,9 +101,9 @@ static void ip_map_put(struct kref *kref) | |||
101 | * IP addresses in reverse-endian (i.e. on a little-endian machine). | 101 | * IP addresses in reverse-endian (i.e. on a little-endian machine). |
102 | * So use a trivial but reliable hash instead | 102 | * So use a trivial but reliable hash instead |
103 | */ | 103 | */ |
104 | static inline int hash_ip(unsigned long ip) | 104 | static inline int hash_ip(__be32 ip) |
105 | { | 105 | { |
106 | int hash = ip ^ (ip>>16); | 106 | int hash = (__force u32)ip ^ ((__force u32)ip>>16); |
107 | return (hash ^ (hash>>8)) & 0xff; | 107 | return (hash ^ (hash>>8)) & 0xff; |
108 | } | 108 | } |
109 | #endif | 109 | #endif |
@@ -284,7 +284,7 @@ static struct ip_map *ip_map_lookup(char *class, struct in_addr addr) | |||
284 | ip.m_addr = addr; | 284 | ip.m_addr = addr; |
285 | ch = sunrpc_cache_lookup(&ip_map_cache, &ip.h, | 285 | ch = sunrpc_cache_lookup(&ip_map_cache, &ip.h, |
286 | hash_str(class, IP_HASHBITS) ^ | 286 | hash_str(class, IP_HASHBITS) ^ |
287 | hash_ip((unsigned long)addr.s_addr)); | 287 | hash_ip(addr.s_addr)); |
288 | 288 | ||
289 | if (ch) | 289 | if (ch) |
290 | return container_of(ch, struct ip_map, h); | 290 | return container_of(ch, struct ip_map, h); |
@@ -313,7 +313,7 @@ static int ip_map_update(struct ip_map *ipm, struct unix_domain *udom, time_t ex | |||
313 | ch = sunrpc_cache_update(&ip_map_cache, | 313 | ch = sunrpc_cache_update(&ip_map_cache, |
314 | &ip.h, &ipm->h, | 314 | &ip.h, &ipm->h, |
315 | hash_str(ipm->m_class, IP_HASHBITS) ^ | 315 | hash_str(ipm->m_class, IP_HASHBITS) ^ |
316 | hash_ip((unsigned long)ipm->m_addr.s_addr)); | 316 | hash_ip(ipm->m_addr.s_addr)); |
317 | if (!ch) | 317 | if (!ch) |
318 | return -ENOMEM; | 318 | return -ENOMEM; |
319 | cache_put(ch, &ip_map_cache); | 319 | cache_put(ch, &ip_map_cache); |