aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libvfio-user.c1
-rw-r--r--samples/client.c2
-rw-r--r--samples/server.c3
3 files changed, 6 insertions, 0 deletions
diff --git a/lib/libvfio-user.c b/lib/libvfio-user.c
index f1c99ec..e4abfad 100644
--- a/lib/libvfio-user.c
+++ b/lib/libvfio-user.c
@@ -2013,6 +2013,7 @@ vfu_dma_transfer(vfu_ctx_t *vfu_ctx, enum vfio_user_command cmd,
size_t rlen;
void *rbuf;
+ assert(cmd == VFIO_USER_DMA_READ || cmd == VFIO_USER_DMA_WRITE);
assert(vfu_ctx != NULL);
assert(sg != NULL);
diff --git a/samples/client.c b/samples/client.c
index 6cd065d..9f90401 100644
--- a/samples/client.c
+++ b/samples/client.c
@@ -1162,6 +1162,8 @@ int main(int argc, char *argv[])
*/
nr_dma_regions = server_max_fds << 1;
+ umask(0022);
+
if ((tmpfd = mkstemp(template)) == -1) {
err(EXIT_FAILURE, "failed to create backing file");
}
diff --git a/samples/server.c b/samples/server.c
index a43dc3c..25b4908 100644
--- a/samples/server.c
+++ b/samples/server.c
@@ -41,6 +41,7 @@
#include <openssl/md5.h>
#include <sys/mman.h>
#include <sys/param.h>
+#include <sys/stat.h>
#include <sys/time.h>
#include "common.h"
@@ -483,6 +484,8 @@ int main(int argc, char *argv[])
err(EXIT_FAILURE, "failed to setup BAR0 region");
}
+ umask(0022);
+
/*
* Setup BAR1 to be 3 pages in size where only the first and the last pages
* are mappable. The client can still mmap the 2nd page, we can't prohibit