Patchwork [v3] block/iscsi.c: Fix printf format error.

login
register
mail settings
Submitter Richard W.M. Jones
Date July 31, 2013, 9:20 p.m.
Message ID <1375305626-26972-1-git-send-email-rjones@redhat.com>
Download mbox | patch
Permalink /patch/263803/
State New
Headers show

Comments

Richard W.M. Jones - July 31, 2013, 9:20 p.m.
From: "Richard W.M. Jones" <rjones@redhat.com>

The error on armv7hl was:

block/iscsi.c: In function ‘is_request_lun_aligned’:
block/iscsi.c:251:26: error: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘int64_t’ [-Werror=format=]
                          iscsilun->block_size, sector_num, nb_sectors);
                          ^

This also splits the long line to comply with qemu coding guidelines.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
---
 block/iscsi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Stefan Weil - Aug. 1, 2013, 4:32 a.m.
Am 31.07.2013 23:20, schrieb Richard W.M. Jones:
> From: "Richard W.M. Jones" <rjones@redhat.com>
>
> The error on armv7hl was:
>
> block/iscsi.c: In function ‘is_request_lun_aligned’:
> block/iscsi.c:251:26: error: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘int64_t’ [-Werror=format=]
>                           iscsilun->block_size, sector_num, nb_sectors);
>                           ^
>
> This also splits the long line to comply with qemu coding guidelines.
>
> Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
> ---
>  block/iscsi.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/block/iscsi.c b/block/iscsi.c
> index 5f28c6a..e7c1c2b 100644
> --- a/block/iscsi.c
> +++ b/block/iscsi.c
> @@ -247,7 +247,9 @@ static bool is_request_lun_aligned(int64_t sector_num, int nb_sectors,
>  {
>      if ((sector_num * BDRV_SECTOR_SIZE) % iscsilun->block_size ||
>          (nb_sectors * BDRV_SECTOR_SIZE) % iscsilun->block_size) {
> -            error_report("iSCSI misaligned request: iscsilun->block_size %u, sector_num %ld, nb_sectors %d",
> +            error_report("iSCSI misaligned request: "
> +                         "iscsilun->block_size %u, sector_num %" PRIi64
> +                         ", nb_sectors %d",
>                           iscsilun->block_size, sector_num, nb_sectors);
>              return 0;
>      }

Reviewed-by: Stefan Weil <sw@weilnetz.de>
Stefan Hajnoczi - Aug. 1, 2013, 9:42 a.m.
On Wed, Jul 31, 2013 at 10:20:26PM +0100, Richard W.M. Jones wrote:
> From: "Richard W.M. Jones" <rjones@redhat.com>
> 
> The error on armv7hl was:
> 
> block/iscsi.c: In function ‘is_request_lun_aligned’:
> block/iscsi.c:251:26: error: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘int64_t’ [-Werror=format=]
>                           iscsilun->block_size, sector_num, nb_sectors);
>                           ^
> 
> This also splits the long line to comply with qemu coding guidelines.
> 
> Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
> ---
>  block/iscsi.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Michael Tokarev - Aug. 2, 2013, 2:07 p.m.
Thanks, applied to the trivial patches queue.

/mjt

Patch

diff --git a/block/iscsi.c b/block/iscsi.c
index 5f28c6a..e7c1c2b 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -247,7 +247,9 @@  static bool is_request_lun_aligned(int64_t sector_num, int nb_sectors,
 {
     if ((sector_num * BDRV_SECTOR_SIZE) % iscsilun->block_size ||
         (nb_sectors * BDRV_SECTOR_SIZE) % iscsilun->block_size) {
-            error_report("iSCSI misaligned request: iscsilun->block_size %u, sector_num %ld, nb_sectors %d",
+            error_report("iSCSI misaligned request: "
+                         "iscsilun->block_size %u, sector_num %" PRIi64
+                         ", nb_sectors %d",
                          iscsilun->block_size, sector_num, nb_sectors);
             return 0;
     }