projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9317d00
)
nvmet-auth: use kmemdup instead of kmalloc + memcpy
author
Zhang Xiaoxu
<zhangxiaoxu5@huawei.com>
Tue, 26 Jul 2022 02:56:32 +0000
(10:56 +0800)
committer
Christoph Hellwig
<hch@lst.de>
Wed, 10 Aug 2022 14:05:09 +0000
(16:05 +0200)
For code neat purpose, we can use kmemdup to replace
kmalloc + memcpy.
Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/target/fabrics-cmd-auth.c
patch
|
blob
|
history
diff --git
a/drivers/nvme/target/fabrics-cmd-auth.c
b/drivers/nvme/target/fabrics-cmd-auth.c
index c851814d6cb0ffec1c6237438220f89e321d3734..ebdf9aa8104199c8b296ba302af9115c31b22a73 100644
(file)
--- a/
drivers/nvme/target/fabrics-cmd-auth.c
+++ b/
drivers/nvme/target/fabrics-cmd-auth.c
@@
-160,10
+160,10
@@
static u16 nvmet_auth_reply(struct nvmet_req *req, void *d)
pr_debug("%s: ctrl %d qid %d host authenticated\n",
__func__, ctrl->cntlid, req->sq->qid);
if (data->cvalid) {
- req->sq->dhchap_c2 = kmalloc(data->hl, GFP_KERNEL);
+ req->sq->dhchap_c2 = kmemdup(data->rval + data->hl, data->hl,
+ GFP_KERNEL);
if (!req->sq->dhchap_c2)
return NVME_AUTH_DHCHAP_FAILURE_FAILED;
- memcpy(req->sq->dhchap_c2, data->rval + data->hl, data->hl);
pr_debug("%s: ctrl %d qid %d challenge %*ph\n",
__func__, ctrl->cntlid, req->sq->qid, data->hl,