diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2017-06-22 13:04:16 +0200 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2017-08-31 12:29:07 +0200 |
commit | 78ee96de6486ab9ff5c38145b55d5fc7de43dd77 (patch) | |
tree | 4ba51b40f2271257d4219c372e73914abfcd8ddf | |
parent | 13f1493f82860cff39e3b8160a3dce557970f95f (diff) |
vvfat: use DIV_ROUND_UP
I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
-rw-r--r-- | block/vvfat.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/block/vvfat.c b/block/vvfat.c index a9e207f7f0..c54fa94651 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -449,7 +449,7 @@ static direntry_t *create_long_filename(BDRVVVFATState *s, const char *filename) return NULL; } - number_of_entries = (length * 2 + 25) / 26; + number_of_entries = DIV_ROUND_UP(length * 2, 26); for(i=0;i<number_of_entries;i++) { entry=array_get_next(&(s->directory)); @@ -2554,7 +2554,7 @@ static int commit_one_file(BDRVVVFATState* s, (size > offset && c >=2 && !fat_eof(s, c))); ret = vvfat_read(s->bs, cluster2sector(s, c), - (uint8_t*)cluster, (rest_size + 0x1ff) / 0x200); + (uint8_t*)cluster, DIV_ROUND_UP(rest_size, 0x200)); if (ret < 0) { qemu_close(fd); |