[Spice-devel] [PATCH 1/4] check properly if red_get_data_chunks fails or not

Christophe Fergeau cfergeau at redhat.com
Fri Jan 8 07:52:07 PST 2016


On Fri, Jan 08, 2016 at 12:11:42PM +0000, Frediano Ziglio wrote:
> Instead of returning 0 which could be a valid value returns an invalid
> one and check on the caller.
> 
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>

Acked-by: Christophe Fergeau <cfergeau at redhat.com>

One comment below.

> ---
>  server/red-parse-qxl.c | 24 +++++++++++++++++-------
>  1 file changed, 17 insertions(+), 7 deletions(-)
> 
> diff --git a/server/red-parse-qxl.c b/server/red-parse-qxl.c
> index 5a14b45..54b1fd4 100644
> --- a/server/red-parse-qxl.c
> +++ b/server/red-parse-qxl.c
> @@ -526,7 +534,7 @@ static SpiceImage *red_get_image(RedMemSlotInfo *slots, int group_id,
>              size = red_get_data_chunks(slots, group_id,
>                                         &chunks, qxl->bitmap.data);
>              spice_assert(size == bitmap_size);
> -            if (size != bitmap_size) {
> +            if (size == INVALID_SIZE || size != bitmap_size) {
>                  red_put_data_chunks(&chunks);
>                  goto error;
>              }

Here...

> @@ -547,7 +555,7 @@ static SpiceImage *red_get_image(RedMemSlotInfo *slots, int group_id,
>                                         memslot_get_id(slots, addr),
>                                         &chunks, (QXLDataChunk *)qxl->quic.data);
>          spice_assert(size == red->u.quic.data_size);
> -        if (size != red->u.quic.data_size) {
> +        if (size == INVALID_SIZE || size != red->u.quic.data_size) {
>              red_put_data_chunks(&chunks);
>              goto error;
>          }

... and here, the check will never trigger as we'll have asserted
before.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20160108/682679b6/attachment.sig>


More information about the Spice-devel mailing list