Skip to content

Commit

Permalink
crytpo: ccp - fix coccinelle warnings
Browse files Browse the repository at this point in the history
drivers/crypto/ccp/ccp-crypto-aes.c:344:1-7: Replace memcpy with struct assignment
drivers/crypto/ccp/ccp-crypto-sha.c:398:1-7: Replace memcpy with struct assignment
drivers/crypto/ccp/ccp-dev.c:578:2-3: Unneeded semicolon
/c/kernel-tests/src/cocci/drivers/crypto/ccp/ccp-dev.c:565:2-3: Unneeded semicolon

Generated by: coccinelle/misc/memcpy-assign.cocci

CC: Tom Lendacky <[email protected]>
Signed-off-by: Fengguang Wu <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
Fengguang Wu authored and herbertx committed Dec 9, 2013
1 parent f7b2b5d commit d1dd206
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion drivers/crypto/ccp/ccp-crypto-aes.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ static int ccp_register_aes_alg(struct list_head *head,

/* Copy the defaults and override as necessary */
alg = &ccp_alg->alg;
memcpy(alg, def->alg_defaults, sizeof(*alg));
*alg = *def->alg_defaults;
snprintf(alg->cra_name, CRYPTO_MAX_ALG_NAME, "%s", def->name);
snprintf(alg->cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s",
def->driver_name);
Expand Down
2 changes: 1 addition & 1 deletion drivers/crypto/ccp/ccp-crypto-sha.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ static int ccp_register_hmac_alg(struct list_head *head,
return -ENOMEM;

/* Copy the base algorithm and only change what's necessary */
memcpy(ccp_alg, base_alg, sizeof(*ccp_alg));
*ccp_alg = *base_alg;
INIT_LIST_HEAD(&ccp_alg->entry);

strncpy(ccp_alg->child_alg, def->name, CRYPTO_MAX_ALG_NAME);
Expand Down
4 changes: 2 additions & 2 deletions drivers/crypto/ccp/ccp-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ static int __init ccp_mod_init(void)
return -ENODEV;
return ccp_pci_init();
break;
};
}

return -ENODEV;
}
Expand All @@ -575,7 +575,7 @@ static void __exit ccp_mod_exit(void)
case 22:
ccp_pci_exit();
break;
};
}
}

module_init(ccp_mod_init);
Expand Down

0 comments on commit d1dd206

Please sign in to comment.