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>
This commit is contained in:
parent
9317d00144
commit
14446f9abd
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue