diff options
author | William Henderson <william.henderson@nutanix.com> | 2023-07-31 11:03:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-31 11:03:40 +0100 |
commit | 56eeb6809e4d68546eae3ff8d0e03aaea66d46d1 (patch) | |
tree | 0e98c127d53d431527e28b437012d292047ffc52 | |
parent | b9ee22b861f95dccffcafac3f7feca5a4ef8e16a (diff) | |
download | libvfio-user-56eeb6809e4d68546eae3ff8d0e03aaea66d46d1.zip libvfio-user-56eeb6809e4d68546eae3ff8d0e03aaea66d46d1.tar.gz libvfio-user-56eeb6809e4d68546eae3ff8d0e03aaea66d46d1.tar.bz2 |
fix: CRC calculation in client sample (#750)
Signed-off-by: William Henderson <william.henderson@nutanix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
-rw-r--r-- | samples/client.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/samples/client.c b/samples/client.c index d4abd21..1e06162 100644 --- a/samples/client.c +++ b/samples/client.c @@ -827,13 +827,11 @@ fake_guest(void *arg) int ret; char buf[fake_guest_data->bar1_size]; FILE *fp = fopen("/dev/urandom", "r"); - uint32_t crc = 0; if (fp == NULL) { err(EXIT_FAILURE, "failed to open /dev/urandom"); } - do { ret = fread(buf, fake_guest_data->bar1_size, 1, fp); if (ret != 1) { @@ -844,11 +842,9 @@ fake_guest(void *arg) if (ret != 0) { err(EXIT_FAILURE, "fake guest failed to write garbage to BAR1"); } - crc = rte_hash_crc(buf, fake_guest_data->bar1_size, crc); - __sync_synchronize(); } while (!fake_guest_data->done); - *fake_guest_data->crcp = crc; + *fake_guest_data->crcp = rte_hash_crc(buf, fake_guest_data->bar1_size, 0); return NULL; } |