Skip to content

Commit 04bbc3e

Browse files
committed
raw-format: Fix error message for invalid offset/size
s->offset and s->size are only set at the end of the function and still contain the old values when formatting the error message. Print the parameters with the new values that we actually checked instead. Fixes: 500e243 ('raw-format: Split raw_read_options()') Signed-off-by: Kevin Wolf <[email protected]> Message-ID: <[email protected]> Reviewed-by: Daniel P. Berrangé <[email protected]> Reviewed-by: Hanna Czenczek <[email protected]> Signed-off-by: Kevin Wolf <[email protected]>
1 parent 2155d2d commit 04bbc3e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

block/raw-format.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,15 @@ raw_apply_options(BlockDriverState *bs, BDRVRawState *s, uint64_t offset,
111111
if (offset > real_size) {
112112
error_setg(errp, "Offset (%" PRIu64 ") cannot be greater than "
113113
"size of the containing file (%" PRId64 ")",
114-
s->offset, real_size);
114+
offset, real_size);
115115
return -EINVAL;
116116
}
117117

118118
if (has_size && (real_size - offset) < size) {
119119
error_setg(errp, "The sum of offset (%" PRIu64 ") and size "
120120
"(%" PRIu64 ") has to be smaller or equal to the "
121121
" actual size of the containing file (%" PRId64 ")",
122-
s->offset, s->size, real_size);
122+
offset, size, real_size);
123123
return -EINVAL;
124124
}
125125

0 commit comments

Comments
 (0)