block/iscsi.c: Fix printf format error.

Submitted by Richard W.M. Jones on July 31, 2013, 7:08 p.m.

Details

Message ID 1375297725-11344-1-git-send-email-rjones@redhat.com
State New
Headers show

Commit Message

Richard W.M. Jones July 31, 2013, 7:08 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);
                          ^
---
 block/iscsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stefan Weil July 31, 2013, 7:29 p.m.
Am 31.07.2013 21:08, 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);
>                           ^
> ---
>  block/iscsi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/block/iscsi.c b/block/iscsi.c
> index 5f28c6a..d02b4fc 100644
> --- a/block/iscsi.c
> +++ b/block/iscsi.c
> @@ -247,7 +247,7 @@ 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;
>      }

Hello Richard,

the fix looks good, but the line is rather long.
It was already too long before, but should now
be split to satisfy the coding style.

Regards,
Stefan

Patch hide | download patch | download mbox

diff --git a/block/iscsi.c b/block/iscsi.c
index 5f28c6a..d02b4fc 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -247,7 +247,7 @@  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;
     }