Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit bfbe27b

Browse files
tobluxherbertx
authored andcommitted
crypto: iaa - Use kmemdup() instead of kzalloc() and memcpy()
Fixes the following two Coccinelle/coccicheck warnings reported by memdup.cocci: iaa_crypto_main.c:350:19-26: WARNING opportunity for kmemdup iaa_crypto_main.c:358:18-25: WARNING opportunity for kmemdup Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com> Reviewed-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent e02ea6f commit bfbe27b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/crypto/intel/iaa/iaa_crypto_main.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,18 +347,16 @@ int add_iaa_compression_mode(const char *name,
347347
goto free;
348348

349349
if (ll_table) {
350-
mode->ll_table = kzalloc(ll_table_size, GFP_KERNEL);
350+
mode->ll_table = kmemdup(ll_table, ll_table_size, GFP_KERNEL);
351351
if (!mode->ll_table)
352352
goto free;
353-
memcpy(mode->ll_table, ll_table, ll_table_size);
354353
mode->ll_table_size = ll_table_size;
355354
}
356355

357356
if (d_table) {
358-
mode->d_table = kzalloc(d_table_size, GFP_KERNEL);
357+
mode->d_table = kmemdup(d_table, d_table_size, GFP_KERNEL);
359358
if (!mode->d_table)
360359
goto free;
361-
memcpy(mode->d_table, d_table, d_table_size);
362360
mode->d_table_size = d_table_size;
363361
}
364362

0 commit comments

Comments
 (0)