[PATCH xserver] xephyr: Don't crash if the server advertises zero xv adaptors

walter harms wharms at bfs.de
Wed Jul 6 07:10:01 UTC 2016



Am 05.07.2016 19:07, schrieb Adam Jackson:
> Useless as an XVideo implementation with zero adaptors might be, it's
> apparently a thing in the wild. Catch this case and bail out of xv init
> if it happens.
> 
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
>  hw/kdrive/ephyr/ephyrvideo.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/kdrive/ephyr/ephyrvideo.c b/hw/kdrive/ephyr/ephyrvideo.c
> index 56a5ff1..31b1eee 100644
> --- a/hw/kdrive/ephyr/ephyrvideo.c
> +++ b/hw/kdrive/ephyr/ephyrvideo.c
> @@ -462,7 +462,7 @@ ephyrXVPrivQueryHostAdaptors(EphyrXVPriv * a_this)
>  
>      if (a_this->host_adaptors)
>          a_this->num_adaptors = a_this->host_adaptors->num_adaptors;
> -    if (a_this->num_adaptors < 0) {
> +    if (a_this->num_adaptors <= 0) {
>          EPHYR_LOG_ERROR("failed to get number of host adaptors\n");
>          goto out;
>      }

can i assume that <0 mean "error" while ==0 means "nothing found" ?

I would suggest the differentiate here, otherwise you may send people
searching for a not existing error.

just my 2 cents,
 wh

ps: yes it happend to me in an unrelated case :)



More information about the xorg-devel mailing list