Skip to content

Commit e3567b6

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 7eb5a7f commit e3567b6

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

libnvme/src/nvme/util.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -411,16 +411,6 @@ const char *nvme_status_to_string(int status, bool fabrics)
411411
return s;
412412
}
413413

414-
static inline void nvme_init_copy_range_elbt(__u8 *elbt, __u64 eilbrt)
415-
{
416-
int i;
417-
418-
for (i = 0; i < 8; i++)
419-
elbt[9 - i] = (eilbrt >> (8 * i)) & 0xff;
420-
elbt[1] = 0;
421-
elbt[0] = 0;
422-
}
423-
424414
void nvme_init_copy_range(struct nvme_copy_range *copy, __u16 *nlbs,
425415
__u64 *slbas, __u32 *eilbrts, __u32 *elbatms,
426416
__u32 *elbats, __u16 nr)
@@ -447,7 +437,7 @@ void nvme_init_copy_range_f1(struct nvme_copy_range_f1 *copy, __u16 *nlbs,
447437
copy[i].slba = cpu_to_le64(slbas[i]);
448438
copy[i].elbatm = cpu_to_le16(elbatms[i]);
449439
copy[i].elbat = cpu_to_le16(elbats[i]);
450-
nvme_init_copy_range_elbt(copy[i].elbt, eilbrts[i]);
440+
*(__le64 *)copy[i].elbt = cpu_to_le64(eilbrts[i]);
451441
}
452442
}
453443

@@ -483,7 +473,7 @@ void nvme_init_copy_range_f3(struct nvme_copy_range_f3 *copy, __u32 *snsids,
483473
copy[i].sopt = cpu_to_le16(sopts[i]);
484474
copy[i].elbatm = cpu_to_le16(elbatms[i]);
485475
copy[i].elbat = cpu_to_le16(elbats[i]);
486-
nvme_init_copy_range_elbt(copy[i].elbt, eilbrts[i]);
476+
*(__le64 *)copy[i].elbt = cpu_to_le64(eilbrts[i]);
487477
}
488478
}
489479

0 commit comments

Comments
 (0)