Commit bfbe27ba authored by Thorsten Blum's avatar Thorsten Blum Committed by Herbert Xu

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: default avatarThorsten Blum <thorsten.blum@toblux.com>
Reviewed-by: default avatarTom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent e02ea6f9
...@@ -347,18 +347,16 @@ int add_iaa_compression_mode(const char *name, ...@@ -347,18 +347,16 @@ int add_iaa_compression_mode(const char *name,
goto free; goto free;
if (ll_table) { if (ll_table) {
mode->ll_table = kzalloc(ll_table_size, GFP_KERNEL); mode->ll_table = kmemdup(ll_table, ll_table_size, GFP_KERNEL);
if (!mode->ll_table) if (!mode->ll_table)
goto free; goto free;
memcpy(mode->ll_table, ll_table, ll_table_size);
mode->ll_table_size = ll_table_size; mode->ll_table_size = ll_table_size;
} }
if (d_table) { if (d_table) {
mode->d_table = kzalloc(d_table_size, GFP_KERNEL); mode->d_table = kmemdup(d_table, d_table_size, GFP_KERNEL);
if (!mode->d_table) if (!mode->d_table)
goto free; goto free;
memcpy(mode->d_table, d_table, d_table_size);
mode->d_table_size = d_table_size; mode->d_table_size = d_table_size;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment