diff mbox

[v8,05/17] qcow2: Use sizeof(**refcount_table)

Message ID 1413979783-1549-6-git-send-email-mreitz@redhat.com
State New
Headers show

Commit Message

Max Reitz Oct. 22, 2014, 12:09 p.m. UTC
When implementing variable refcounts, we want to be able to easily find
all the places in qemu which are tied to a certain refcount order.
Replace sizeof(uint16_t) in the check code by sizeof(**refcount_table)
so we can later find it more easily.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 block/qcow2-refcount.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eric Blake Oct. 22, 2014, 2:38 p.m. UTC | #1
On 10/22/2014 06:09 AM, Max Reitz wrote:
> When implementing variable refcounts, we want to be able to easily find
> all the places in qemu which are tied to a certain refcount order.
> Replace sizeof(uint16_t) in the check code by sizeof(**refcount_table)
> so we can later find it more easily.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  block/qcow2-refcount.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Eric Blake <eblake@redhat.com>
diff mbox

Patch

diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index e5f7876..e8b9df9 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -1647,7 +1647,7 @@  static int check_refblocks(BlockDriverState *bs, BdrvCheckResult *res,
                                                   *nb_clusters);
                         memset(&(*refcount_table)[old_nb_clusters], 0,
                                (*nb_clusters - old_nb_clusters) *
-                               sizeof(uint16_t));
+                               sizeof(**refcount_table));
                     }
                     (*refcount_table)[cluster]--;
                     inc_refcounts(bs, res, *refcount_table, *nb_clusters,