97 lines
1.9 KiB
Diff
97 lines
1.9 KiB
Diff
--- usr.sbin/bhyve/fwctl.c.orig
|
|
+++ usr.sbin/bhyve/fwctl.c
|
|
@@ -79,8 +79,8 @@
|
|
|
|
struct op_info {
|
|
int op;
|
|
- int (*op_start)(int len);
|
|
- void (*op_data)(uint32_t data, int len);
|
|
+ int (*op_start)(uint32_t len);
|
|
+ void (*op_data)(uint32_t data, uint32_t len);
|
|
int (*op_result)(struct iovec **data);
|
|
void (*op_done)(struct iovec *data);
|
|
};
|
|
@@ -119,7 +119,7 @@
|
|
}
|
|
|
|
static int
|
|
-errop_start(int len)
|
|
+errop_start(uint32_t len)
|
|
{
|
|
errop_code = ENOENT;
|
|
|
|
@@ -128,7 +128,7 @@
|
|
}
|
|
|
|
static void
|
|
-errop_data(uint32_t data, int len)
|
|
+errop_data(uint32_t data, uint32_t len)
|
|
{
|
|
|
|
/* ignore */
|
|
@@ -188,7 +188,7 @@
|
|
static size_t fget_size;
|
|
|
|
static int
|
|
-fget_start(int len)
|
|
+fget_start(uint32_t len)
|
|
{
|
|
|
|
if (len > FGET_STRSZ)
|
|
@@ -200,7 +200,7 @@
|
|
}
|
|
|
|
static void
|
|
-fget_data(uint32_t data, int len)
|
|
+fget_data(uint32_t data, uint32_t len)
|
|
{
|
|
|
|
*((uint32_t *) &fget_str[fget_cnt]) = data;
|
|
@@ -285,8 +285,8 @@
|
|
struct op_info *req_op;
|
|
int resp_error;
|
|
int resp_count;
|
|
- int resp_size;
|
|
- int resp_off;
|
|
+ size_t resp_size;
|
|
+ size_t resp_off;
|
|
struct iovec *resp_biov;
|
|
} rinfo;
|
|
|
|
@@ -346,13 +346,14 @@
|
|
static int
|
|
fwctl_request_data(uint32_t value)
|
|
{
|
|
- int remlen;
|
|
|
|
/* Make sure remaining size is >= 0 */
|
|
- rinfo.req_size -= sizeof(uint32_t);
|
|
- remlen = MAX(rinfo.req_size, 0);
|
|
+ if (rinfo.req_size <= sizeof(uint32_t))
|
|
+ rinfo.req_size = 0;
|
|
+ else
|
|
+ rinfo.req_size -= sizeof(uint32_t);
|
|
|
|
- (*rinfo.req_op->op_data)(value, remlen);
|
|
+ (*rinfo.req_op->op_data)(value, rinfo.req_size);
|
|
|
|
if (rinfo.req_size < sizeof(uint32_t)) {
|
|
fwctl_request_done();
|
|
@@ -401,7 +402,7 @@
|
|
fwctl_response(uint32_t *retval)
|
|
{
|
|
uint32_t *dp;
|
|
- int remlen;
|
|
+ ssize_t remlen;
|
|
|
|
switch(rinfo.resp_count) {
|
|
case 0:
|
|
@@ -436,7 +437,7 @@
|
|
}
|
|
|
|
if (rinfo.resp_count > 3 &&
|
|
- rinfo.resp_size - rinfo.resp_off <= 0) {
|
|
+ rinfo.resp_off >= rinfo.resp_size) {
|
|
fwctl_response_done();
|
|
return (1);
|
|
}
|