Re: [PATCH 1/4] check properly if red_get_data_chunks fails or not

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>

Acked-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>

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

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]