mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
nvmet: use memcpy_and_pad for identify sn/fr
This changes the earlier patch "nvmet: don't report 0-bytes in serial number" to use the memcpy_and_pad() helper introduced in a previous patch. Signed-off-by: Martin Wilck <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
This commit is contained in:
parent
01f33c336e
commit
17c39d053a
1 changed files with 3 additions and 11 deletions
|
|
@ -168,15 +168,6 @@ out:
|
|||
nvmet_req_complete(req, status);
|
||||
}
|
||||
|
||||
static void copy_and_pad(char *dst, int dst_len, const char *src, int src_len)
|
||||
{
|
||||
int len = min(src_len, dst_len);
|
||||
|
||||
memcpy(dst, src, len);
|
||||
if (dst_len > len)
|
||||
memset(dst + len, ' ', dst_len - len);
|
||||
}
|
||||
|
||||
static void nvmet_execute_identify_ctrl(struct nvmet_req *req)
|
||||
{
|
||||
struct nvmet_ctrl *ctrl = req->sq->ctrl;
|
||||
|
|
@ -196,8 +187,9 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req)
|
|||
|
||||
bin2hex(id->sn, &ctrl->subsys->serial,
|
||||
min(sizeof(ctrl->subsys->serial), sizeof(id->sn) / 2));
|
||||
copy_and_pad(id->mn, sizeof(id->mn), model, sizeof(model) - 1);
|
||||
copy_and_pad(id->fr, sizeof(id->fr), UTS_RELEASE, strlen(UTS_RELEASE));
|
||||
memcpy_and_pad(id->mn, sizeof(id->mn), model, sizeof(model) - 1, ' ');
|
||||
memcpy_and_pad(id->fr, sizeof(id->fr),
|
||||
UTS_RELEASE, strlen(UTS_RELEASE), ' ');
|
||||
|
||||
id->rab = 6;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue