From 0f6f91a8ceee9d6810c2705a60b544a42a930acf Mon Sep 17 00:00:00 2001 From: Marcelo Araujo Date: Wed, 7 Nov 2018 06:29:01 +0000 Subject: [PATCH] Comestic change to try to inline the memset with SSE/AVX instructions. Also switch from int to size_t to keep portability. Reviewed by: brooks Sponsored by: iXsystems Inc. Differential Revision: https://reviews.freebsd.org/D17795 --- usr.sbin/bhyve/pci_nvme.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c index 83051f1aa18..9000655d5d0 100644 --- a/usr.sbin/bhyve/pci_nvme.c +++ b/usr.sbin/bhyve/pci_nvme.c @@ -251,11 +251,13 @@ static void pci_nvme_io_partial(struct blockif_req *br, int err); (NVME_STATUS_SC_MASK << NVME_STATUS_SC_SHIFT)) static __inline void -cpywithpad(char *dst, int dst_size, const char *src, char pad) +cpywithpad(char *dst, size_t dst_size, const char *src, char pad) { - int len = strnlen(src, dst_size); + size_t len; + + len = strnlen(src, dst_size); + memset(dst, pad, dst_size); memcpy(dst, src, len); - memset(dst + len, pad, dst_size - len); } static __inline void