You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
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>
This commit is contained in:
committed by
David S. Miller
parent
cb508701ef
commit
65d9d2cac5
+2
-4
@@ -306,10 +306,9 @@ static int rxrpc_krb5_decode_tagged_data(struct krb5_tagged_data *td,
|
|||||||
td->data_len = len;
|
td->data_len = len;
|
||||||
|
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
td->data = kmalloc(len, GFP_KERNEL);
|
td->data = kmemdup(xdr, len, GFP_KERNEL);
|
||||||
if (!td->data)
|
if (!td->data)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
memcpy(td->data, xdr, len);
|
|
||||||
len = (len + 3) & ~3;
|
len = (len + 3) & ~3;
|
||||||
toklen -= len;
|
toklen -= len;
|
||||||
xdr += len >> 2;
|
xdr += len >> 2;
|
||||||
@@ -401,10 +400,9 @@ static int rxrpc_krb5_decode_ticket(u8 **_ticket, u16 *_tktlen,
|
|||||||
_debug("ticket len %u", len);
|
_debug("ticket len %u", len);
|
||||||
|
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
*_ticket = kmalloc(len, GFP_KERNEL);
|
*_ticket = kmemdup(xdr, len, GFP_KERNEL);
|
||||||
if (!*_ticket)
|
if (!*_ticket)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
memcpy(*_ticket, xdr, len);
|
|
||||||
len = (len + 3) & ~3;
|
len = (len + 3) & ~3;
|
||||||
toklen -= len;
|
toklen -= len;
|
||||||
xdr += len >> 2;
|
xdr += len >> 2;
|
||||||
|
|||||||
Reference in New Issue
Block a user