Skip to content

Commit 43b996f

Browse files
committed
libnvme/util: fix nvme_init_copy_range_elbt() endian error
Since converted to big endian so fix to little endian. Signed-off-by: Tokunori Ikegami <[email protected]>
1 parent e550ee8 commit 43b996f

1 file changed

Lines changed: 2 additions & 12 deletions

File tree

libnvme/src/nvme/cmds.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -413,16 +413,6 @@ int nvme_get_logical_block_size(struct nvme_transport_handle *hdl,
413413
return 0;
414414
}
415415

416-
static inline void nvme_init_copy_range_elbt(__u8 *elbt, __u64 eilbrt)
417-
{
418-
int i;
419-
420-
for (i = 0; i < 8; i++)
421-
elbt[9 - i] = (eilbrt >> (8 * i)) & 0xff;
422-
elbt[1] = 0;
423-
elbt[0] = 0;
424-
}
425-
426416
void nvme_init_copy_range(struct nvme_copy_range *copy, __u16 *nlbs,
427417
__u64 *slbas, __u32 *eilbrts, __u32 *elbatms,
428418
__u32 *elbats, __u16 nr)
@@ -449,7 +439,7 @@ void nvme_init_copy_range_f1(struct nvme_copy_range_f1 *copy, __u16 *nlbs,
449439
copy[i].slba = cpu_to_le64(slbas[i]);
450440
copy[i].elbatm = cpu_to_le16(elbatms[i]);
451441
copy[i].elbat = cpu_to_le16(elbats[i]);
452-
nvme_init_copy_range_elbt(copy[i].elbt, eilbrts[i]);
442+
*(__le64 *)copy[i].elbt = cpu_to_le64(eilbrts[i]);
453443
}
454444
}
455445

@@ -485,7 +475,7 @@ void nvme_init_copy_range_f3(struct nvme_copy_range_f3 *copy, __u32 *snsids,
485475
copy[i].sopt = cpu_to_le16(sopts[i]);
486476
copy[i].elbatm = cpu_to_le16(elbatms[i]);
487477
copy[i].elbat = cpu_to_le16(elbats[i]);
488-
nvme_init_copy_range_elbt(copy[i].elbt, eilbrts[i]);
478+
*(__le64 *)copy[i].elbt = cpu_to_le64(eilbrts[i]);
489479
}
490480
}
491481

0 commit comments

Comments
 (0)