diff mbox series

[v2,01/13] block/export: shorten serial string to fit

Message ID 20200924151549.913737-2-stefanha@redhat.com
State Superseded
Headers show
Series block/export: convert vhost-user-blk-server to block exports API | expand

Commit Message

Stefan Hajnoczi Sept. 24, 2020, 3:15 p.m. UTC
The serial field is only 20 bytes long. Shorten the string so it fits.

This fixes the following compiler warning:

  ../block/export/vhost-user-blk-server.c:178:50: error: ā€˜%sā€™ directive output truncated writing 21 bytes into a region of size 20 [-Werror=format-truncation=]
  178 |         snprintf(elem->in_sg[0].iov_base, size, "%s", "vhost_user_blk_server");
      |                                                  ^~   ~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 block/export/vhost-user-blk-server.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/block/export/vhost-user-blk-server.c b/block/export/vhost-user-blk-server.c
index ec78130f09..fb7764a730 100644
--- a/block/export/vhost-user-blk-server.c
+++ b/block/export/vhost-user-blk-server.c
@@ -175,7 +175,7 @@  static void coroutine_fn vu_block_virtio_process_req(void *opaque)
     case VIRTIO_BLK_T_GET_ID: {
         size_t size = MIN(iov_size(&elem->in_sg[0], in_num),
                           VIRTIO_BLK_ID_BYTES);
-        snprintf(elem->in_sg[0].iov_base, size, "%s", "vhost_user_blk_server");
+        snprintf(elem->in_sg[0].iov_base, size, "%s", "vhost_user_blk");
         req->in->status = VIRTIO_BLK_S_OK;
         req->size = elem->in_sg[0].iov_len;
         break;