diff mbox series

vhost-user-scsi: fix printf format warning

Message ID 1576074210-52834-9-git-send-email-pbonzini@redhat.com
State New
Headers show
Series vhost-user-scsi: fix printf format warning | expand

Commit Message

Paolo Bonzini Dec. 11, 2019, 2:23 p.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Fixes:
../contrib/vhost-user-scsi/vhost-user-scsi.c:118:57: error: format specifies
      type 'unsigned char' but the argument has type 'int' [-Werror,-Wformat]
    g_warning("Unable to determine cdb len (0x%02hhX)", cdb[0] >> 5);

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 contrib/vhost-user-scsi/vhost-user-scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Thomas Huth Dec. 11, 2019, 7:34 p.m. UTC | #1
On 11/12/2019 15.23, Paolo Bonzini wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Fixes:
> ../contrib/vhost-user-scsi/vhost-user-scsi.c:118:57: error: format specifies
>       type 'unsigned char' but the argument has type 'int' [-Werror,-Wformat]
>     g_warning("Unable to determine cdb len (0x%02hhX)", cdb[0] >> 5);
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  contrib/vhost-user-scsi/vhost-user-scsi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/contrib/vhost-user-scsi/vhost-user-scsi.c b/contrib/vhost-user-scsi/vhost-user-scsi.c
> index 0fc14d7..7a1db16 100644
> --- a/contrib/vhost-user-scsi/vhost-user-scsi.c
> +++ b/contrib/vhost-user-scsi/vhost-user-scsi.c
> @@ -115,7 +115,7 @@ static int get_cdb_len(uint8_t *cdb)
>      case 4: return 16;
>      case 5: return 12;
>      }
> -    g_warning("Unable to determine cdb len (0x%02hhX)", cdb[0] >> 5);
> +    g_warning("Unable to determine cdb len (0x%02hhX)", (uint8_t)(cdb[0] >> 5));
>      return -1;
>  }

Reviewed-by: Thomas Huth <thuth@redhat.com>
diff mbox series

Patch

diff --git a/contrib/vhost-user-scsi/vhost-user-scsi.c b/contrib/vhost-user-scsi/vhost-user-scsi.c
index 0fc14d7..7a1db16 100644
--- a/contrib/vhost-user-scsi/vhost-user-scsi.c
+++ b/contrib/vhost-user-scsi/vhost-user-scsi.c
@@ -115,7 +115,7 @@  static int get_cdb_len(uint8_t *cdb)
     case 4: return 16;
     case 5: return 12;
     }
-    g_warning("Unable to determine cdb len (0x%02hhX)", cdb[0] >> 5);
+    g_warning("Unable to determine cdb len (0x%02hhX)", (uint8_t)(cdb[0] >> 5));
     return -1;
 }