Skip to content

Commit 86c3a3e

Browse files
tstrukdavem330
authored andcommitted
tipc: use consistent GFP flags
Some functions, like tipc_crypto_start use inconsisten GFP flags when allocating memory. The mentioned function use GFP_ATOMIC to to alloc a crypto instance, and then calls alloc_ordered_workqueue() which allocates memory with GFP_KERNEL. tipc_aead_init() function even uses GFP_KERNEL and GFP_ATOMIC interchangeably. No doc comment specifies what context a function is designed to work in, but the flags should at least be consistent within a function. Cc: Jon Maloy <[email protected]> Cc: Ying Xue <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Jakub Kicinski <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Signed-off-by: Tadeusz Struk <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1aa3b22 commit 86c3a3e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

net/tipc/crypto.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ static int tipc_aead_init(struct tipc_aead **aead, struct tipc_aead_key *ukey,
524524
return -EEXIST;
525525

526526
/* Allocate a new AEAD */
527-
tmp = kzalloc(sizeof(*tmp), GFP_ATOMIC);
527+
tmp = kzalloc(sizeof(*tmp), GFP_KERNEL);
528528
if (unlikely(!tmp))
529529
return -ENOMEM;
530530

@@ -1470,7 +1470,7 @@ int tipc_crypto_start(struct tipc_crypto **crypto, struct net *net,
14701470
return -EEXIST;
14711471

14721472
/* Allocate crypto */
1473-
c = kzalloc(sizeof(*c), GFP_ATOMIC);
1473+
c = kzalloc(sizeof(*c), GFP_KERNEL);
14741474
if (!c)
14751475
return -ENOMEM;
14761476

@@ -1484,7 +1484,7 @@ int tipc_crypto_start(struct tipc_crypto **crypto, struct net *net,
14841484
}
14851485

14861486
/* Allocate statistic structure */
1487-
c->stats = alloc_percpu_gfp(struct tipc_crypto_stats, GFP_ATOMIC);
1487+
c->stats = alloc_percpu(struct tipc_crypto_stats);
14881488
if (!c->stats) {
14891489
if (c->wq)
14901490
destroy_workqueue(c->wq);
@@ -2457,7 +2457,7 @@ static void tipc_crypto_work_tx(struct work_struct *work)
24572457
}
24582458

24592459
/* Lets duplicate it first */
2460-
skey = kmemdup(aead->key, tipc_aead_key_size(aead->key), GFP_ATOMIC);
2460+
skey = kmemdup(aead->key, tipc_aead_key_size(aead->key), GFP_KERNEL);
24612461
rcu_read_unlock();
24622462

24632463
/* Now, generate new key, initiate & distribute it */

0 commit comments

Comments
 (0)