[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/4] vmdk: check for negative sector nums also
From: |
Stefan Weil |
Subject: |
Re: [Qemu-devel] [PATCH 1/4] vmdk: check for negative sector nums also |
Date: |
Thu, 19 Feb 2009 22:44:40 +0100 |
User-agent: |
Mozilla-Thunderbird 2.0.0.19 (X11/20090103) |
Eduardo Habkost schrieb:
> Signed-off-by: Eduardo Habkost <address@hidden>
> ---
> block-vmdk.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/block-vmdk.c b/block-vmdk.c
> index 71d7504..416fb95 100644
> --- a/block-vmdk.c
> +++ b/block-vmdk.c
> @@ -649,7 +649,7 @@ static int vmdk_write(BlockDriverState *bs, int64_t
> sector_num,
>
Why is sector_num signed? An unsigned quantity would simplify the code below
(no need to check for < 0).
> uint64_t cluster_offset;
> static int cid_update = 0;
>
> - if (sector_num > bs->total_sectors) {
> + if (sector_num < 0 || sector_num > bs->total_sectors) {
> fprintf(stderr,
> "(VMDK) Wrong offset: sector_num=0x%" PRIx64
> " total_sectors=0x%" PRIx64 "\n",
>
Regards
Stefan Weil