Code Review
/
deb_dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
New upstream version 16.11.4
[deb_dpdk.git]
/
drivers
/
net
/
virtio
/
virtio_user
/
vhost_user.c
diff --git
a/drivers/net/virtio/virtio_user/vhost_user.c
b/drivers/net/virtio/virtio_user/vhost_user.c
index
a2b0687
..
6f4845b
100644
(file)
--- a/
drivers/net/virtio/virtio_user/vhost_user.c
+++ b/
drivers/net/virtio/virtio_user/vhost_user.c
@@
-97,6
+97,10
@@
vhost_user_read(int fd, struct vhost_user_msg *msg)
}
sz_payload = msg->size;
}
sz_payload = msg->size;
+
+ if ((size_t)sz_payload > sizeof(msg->payload))
+ goto fail;
+
if (sz_payload) {
ret = recv(fd, (void *)((char *)msg + sz_hdr), sz_payload, 0);
if (ret < sz_payload) {
if (sz_payload) {
ret = recv(fd, (void *)((char *)msg + sz_hdr), sz_payload, 0);
if (ret < sz_payload) {
@@
-181,7
+185,7
@@
get_hugepage_file_info(struct hugepage_file_info huges[], int max)
}
huges[idx].addr = v_start;
huges[idx].size = v_end - v_start;
}
huges[idx].addr = v_start;
huges[idx].size = v_end - v_start;
- s
trcpy(huges[idx].path
, tmp);
+ s
nprintf(huges[idx].path, PATH_MAX, "%s"
, tmp);
idx++;
}
idx++;
}
@@
-392,7
+396,8
@@
vhost_user_setup(const char *path)
}
flag = fcntl(fd, F_GETFD);
}
flag = fcntl(fd, F_GETFD);
- fcntl(fd, F_SETFD, flag | FD_CLOEXEC);
+ if (fcntl(fd, F_SETFD, flag | FD_CLOEXEC) < 0)
+ PMD_DRV_LOG(WARNING, "fcntl failed, %s", strerror(errno));
memset(&un, 0, sizeof(un));
un.sun_family = AF_UNIX;
memset(&un, 0, sizeof(un));
un.sun_family = AF_UNIX;