Fix off-by-one in jobs_eta allocation
[fio.git] / server.c
index db9d8594c8b84c59003cf0d58270bbca197c8fb5..2c20e37b7e053f60d3528d4909b82d721edd2032 100644 (file)
--- a/server.c
+++ b/server.c
@@ -299,7 +299,7 @@ int fio_net_send_simple_cmd(int sk, uint16_t opcode, uint64_t tag,
 
        cmd = malloc(sizeof(*cmd));
 
-       fio_init_net_cmd(&cmd->cmd, opcode, NULL, 0, (uint64_t) cmd);
+       fio_init_net_cmd(&cmd->cmd, opcode, NULL, 0, (uintptr_t) cmd);
        fio_net_cmd_crc(&cmd->cmd);
 
        INIT_FLIST_HEAD(&cmd->list);
@@ -398,6 +398,8 @@ static int handle_probe_cmd(struct fio_net_cmd *cmd)
        probe.os        = FIO_OS;
        probe.arch      = FIO_ARCH;
 
+       probe.bpp       = sizeof(void *);
+
        return fio_net_send_cmd(server_fd, FIO_NET_CMD_PROBE, &probe, sizeof(probe), cmd->tag);
 }
 
@@ -407,7 +409,10 @@ static int handle_send_eta_cmd(struct fio_net_cmd *cmd)
        size_t size;
        int i;
 
-       size = sizeof(*je) + thread_number * sizeof(char);
+       if (!thread_number)
+               return 0;
+
+       size = sizeof(*je) + thread_number * sizeof(char) + 1;
        je = malloc(size);
        memset(je, 0, size);