diff options
author | Zhang Xiaoxu <zhangxiaoxu5@huawei.com> | 2022-07-26 10:56:32 +0800 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2022-08-10 16:05:09 +0200 |
commit | 14446f9abd609791064d222ccf3c7b3af1772358 (patch) | |
tree | 91d70c8e54ca015e618f431f42909e3e1ed3f704 /drivers/nvme | |
parent | 9317d0014499182c77a03cd095e83bcfb0f53750 (diff) | |
download | linux-14446f9abd609791064d222ccf3c7b3af1772358.tar.bz2 |
nvmet-auth: use kmemdup instead of kmalloc + memcpy
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>
Diffstat (limited to 'drivers/nvme')
-rw-r--r-- | drivers/nvme/target/fabrics-cmd-auth.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/nvme/target/fabrics-cmd-auth.c b/drivers/nvme/target/fabrics-cmd-auth.c index c851814d6cb0..ebdf9aa81041 100644 --- 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, |