From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NfHMK-0005RJ-6j for qemu-devel@nongnu.org; Wed, 10 Feb 2010 13:32:20 -0500 Received: from [199.232.76.173] (port=49507 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NfHMJ-0005Qz-Lz for qemu-devel@nongnu.org; Wed, 10 Feb 2010 13:32:19 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NfHMI-00019u-6S for qemu-devel@nongnu.org; Wed, 10 Feb 2010 13:32:19 -0500 Received: from mail-iw0-f194.google.com ([209.85.223.194]:46951) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NfHMH-000178-T0 for qemu-devel@nongnu.org; Wed, 10 Feb 2010 13:32:18 -0500 Received: by mail-iw0-f194.google.com with SMTP id 32so527339iwn.14 for ; Wed, 10 Feb 2010 10:32:17 -0800 (PST) Message-ID: <4B72FBAD.8050704@codemonkey.ws> Date: Wed, 10 Feb 2010 12:32:13 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] qcow2: Fix signedness bugs References: <1265120457-25143-1-git-send-email-kwolf@redhat.com> In-Reply-To: <1265120457-25143-1-git-send-email-kwolf@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org On 02/02/2010 08:20 AM, Kevin Wolf wrote: > Checking for return codes< 0 isn't really going to work with unsigned > types. Use signed types instead. > > Signed-off-by: Kevin Wolf > Applied. Thanks. Regards, Anthony Liguori > --- > block/qcow2-cluster.c | 12 ++++++------ > block/qcow2.h | 6 ++---- > 2 files changed, 8 insertions(+), 10 deletions(-) > > diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c > index 4e30d16..3501a94 100644 > --- a/block/qcow2-cluster.c > +++ b/block/qcow2-cluster.c > @@ -219,7 +219,8 @@ static uint64_t *l2_allocate(BlockDriverState *bs, int l1_index) > BDRVQcowState *s = bs->opaque; > int min_index; > uint64_t old_l2_offset; > - uint64_t *l2_table, l2_offset; > + uint64_t *l2_table; > + int64_t l2_offset; > > old_l2_offset = s->l1_table[l1_index]; > > @@ -560,7 +561,8 @@ uint64_t qcow2_alloc_compressed_cluster_offset(BlockDriverState *bs, > { > BDRVQcowState *s = bs->opaque; > int l2_index, ret; > - uint64_t l2_offset, *l2_table, cluster_offset; > + uint64_t l2_offset, *l2_table; > + int64_t cluster_offset; > int nb_csectors; > > ret = get_cluster_table(bs, offset,&l2_table,&l2_offset,&l2_index); > @@ -704,10 +706,8 @@ err: > * > * Return 0 on success and -errno in error cases > */ > -uint64_t qcow2_alloc_cluster_offset(BlockDriverState *bs, > - uint64_t offset, > - int n_start, int n_end, > - int *num, QCowL2Meta *m) > +int qcow2_alloc_cluster_offset(BlockDriverState *bs, uint64_t offset, > + int n_start, int n_end, int *num, QCowL2Meta *m) > { > BDRVQcowState *s = bs->opaque; > int l2_index, ret; > diff --git a/block/qcow2.h b/block/qcow2.h > index d9ea6ab..de9397a 100644 > --- a/block/qcow2.h > +++ b/block/qcow2.h > @@ -192,10 +192,8 @@ void qcow2_encrypt_sectors(BDRVQcowState *s, int64_t sector_num, > > uint64_t qcow2_get_cluster_offset(BlockDriverState *bs, uint64_t offset, > int *num); > -uint64_t qcow2_alloc_cluster_offset(BlockDriverState *bs, > - uint64_t offset, > - int n_start, int n_end, > - int *num, QCowL2Meta *m); > +int qcow2_alloc_cluster_offset(BlockDriverState *bs, uint64_t offset, > + int n_start, int n_end, int *num, QCowL2Meta *m); > uint64_t qcow2_alloc_compressed_cluster_offset(BlockDriverState *bs, > uint64_t offset, > int compressed_size); >