aboutsummaryrefslogtreecommitdiffstats
path: root/net/rxrpc/ar-key.c
diff options
context:
space:
mode:
authorThomas Meyer <thomas@m3y3r.de>2011-11-17 07:43:40 -0500
committerDavid S. Miller <davem@davemloft.net>2011-11-21 15:02:36 -0500
commit65d9d2cac5ee2a33b0cec7044171f67d290e7d6e (patch)
tree9366b8a17136951703680f781383a65e34212845 /net/rxrpc/ar-key.c
parentcb508701efa01ba8628ff2d4280dbbb713d62955 (diff)
RxRPC: Use kmemdup rather than duplicating its implementation
The semantic patch that makes this change is available in scripts/coccinelle/api/memdup.cocci. Signed-off-by: Thomas Meyer <thomas@m3y3r.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rxrpc/ar-key.c')
-rw-r--r--net/rxrpc/ar-key.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/net/rxrpc/ar-key.c b/net/rxrpc/ar-key.c
index 43ea7de2fc8e..4cba13e46ffd 100644
--- a/net/rxrpc/ar-key.c
+++ b/net/rxrpc/ar-key.c
@@ -306,10 +306,9 @@ static int rxrpc_krb5_decode_tagged_data(struct krb5_tagged_data *td,
306 td->data_len = len; 306 td->data_len = len;
307 307
308 if (len > 0) { 308 if (len > 0) {
309 td->data = kmalloc(len, GFP_KERNEL); 309 td->data = kmemdup(xdr, len, GFP_KERNEL);
310 if (!td->data) 310 if (!td->data)
311 return -ENOMEM; 311 return -ENOMEM;
312 memcpy(td->data, xdr, len);
313 len = (len + 3) & ~3; 312 len = (len + 3) & ~3;
314 toklen -= len; 313 toklen -= len;
315 xdr += len >> 2; 314 xdr += len >> 2;
@@ -401,10 +400,9 @@ static int rxrpc_krb5_decode_ticket(u8 **_ticket, u16 *_tktlen,
401 _debug("ticket len %u", len); 400 _debug("ticket len %u", len);
402 401
403 if (len > 0) { 402 if (len > 0) {
404 *_ticket = kmalloc(len, GFP_KERNEL); 403 *_ticket = kmemdup(xdr, len, GFP_KERNEL);
405 if (!*_ticket) 404 if (!*_ticket)
406 return -ENOMEM; 405 return -ENOMEM;
407 memcpy(*_ticket, xdr, len);
408 len = (len + 3) & ~3; 406 len = (len + 3) & ~3;
409 toklen -= len; 407 toklen -= len;
410 xdr += len >> 2; 408 xdr += len >> 2;