mirror of https://github.com/xemu-project/xemu.git
block/cloop: use PRIu32 format specifier for uint32_t
PRIu32 is the format string specifier for uint32_t, let's use it. Variables ->block_size, ->n_blocks, and i are all uint32_t. Suggested-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
9b17031ac4
commit
370e681629
|
@ -72,7 +72,7 @@ static int cloop_open(BlockDriverState *bs, QDict *options, int flags,
|
||||||
}
|
}
|
||||||
s->block_size = be32_to_cpu(s->block_size);
|
s->block_size = be32_to_cpu(s->block_size);
|
||||||
if (s->block_size % 512) {
|
if (s->block_size % 512) {
|
||||||
error_setg(errp, "block_size %u must be a multiple of 512",
|
error_setg(errp, "block_size %" PRIu32 " must be a multiple of 512",
|
||||||
s->block_size);
|
s->block_size);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ static int cloop_open(BlockDriverState *bs, QDict *options, int flags,
|
||||||
* need a buffer this big.
|
* need a buffer this big.
|
||||||
*/
|
*/
|
||||||
if (s->block_size > MAX_BLOCK_SIZE) {
|
if (s->block_size > MAX_BLOCK_SIZE) {
|
||||||
error_setg(errp, "block_size %u must be %u MB or less",
|
error_setg(errp, "block_size %" PRIu32 " must be %u MB or less",
|
||||||
s->block_size,
|
s->block_size,
|
||||||
MAX_BLOCK_SIZE / (1024 * 1024));
|
MAX_BLOCK_SIZE / (1024 * 1024));
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -101,7 +101,7 @@ static int cloop_open(BlockDriverState *bs, QDict *options, int flags,
|
||||||
/* read offsets */
|
/* read offsets */
|
||||||
if (s->n_blocks > (UINT32_MAX - 1) / sizeof(uint64_t)) {
|
if (s->n_blocks > (UINT32_MAX - 1) / sizeof(uint64_t)) {
|
||||||
/* Prevent integer overflow */
|
/* Prevent integer overflow */
|
||||||
error_setg(errp, "n_blocks %u must be %zu or less",
|
error_setg(errp, "n_blocks %" PRIu32 " must be %zu or less",
|
||||||
s->n_blocks,
|
s->n_blocks,
|
||||||
(UINT32_MAX - 1) / sizeof(uint64_t));
|
(UINT32_MAX - 1) / sizeof(uint64_t));
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -133,7 +133,7 @@ static int cloop_open(BlockDriverState *bs, QDict *options, int flags,
|
||||||
|
|
||||||
if (s->offsets[i] < s->offsets[i - 1]) {
|
if (s->offsets[i] < s->offsets[i - 1]) {
|
||||||
error_setg(errp, "offsets not monotonically increasing at "
|
error_setg(errp, "offsets not monotonically increasing at "
|
||||||
"index %u, image file is corrupt", i);
|
"index %" PRIu32 ", image file is corrupt", i);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
@ -146,8 +146,8 @@ static int cloop_open(BlockDriverState *bs, QDict *options, int flags,
|
||||||
* ridiculous s->compressed_block allocation.
|
* ridiculous s->compressed_block allocation.
|
||||||
*/
|
*/
|
||||||
if (size > 2 * MAX_BLOCK_SIZE) {
|
if (size > 2 * MAX_BLOCK_SIZE) {
|
||||||
error_setg(errp, "invalid compressed block size at index %u, "
|
error_setg(errp, "invalid compressed block size at index %" PRIu32
|
||||||
"image file is corrupt", i);
|
", image file is corrupt", i);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue