Re: [PATCH] adsp: Fix test on unsigned in find_adsp_module_by_id()

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

 



On Fri, Oct 16, 2009 at 7:51 PM, Roel Kluin <roel.kluin@xxxxxxxxx> wrote:
> A negative id will not be noticed unless the comparison is signed.
>
> Signed-off-by: Roel Kluin <roel.kluin@xxxxxxxxx>
> ---
> diff --git a/drivers/staging/dream/qdsp5/adsp.c b/drivers/staging/dream/qdsp5/adsp.c
> index d096456..6948bdc 100644
> --- a/drivers/staging/dream/qdsp5/adsp.c
> +++ b/drivers/staging/dream/qdsp5/adsp.c
> @@ -171,7 +171,7 @@ static struct msm_adsp_module *find_adsp_module_by_id(
>        } else {
>  #if CONFIG_MSM_AMSS_VERSION >= 6350
>                id = get_module_index(id);
> -               if (id < 0)
> +               if ((int)id < 0)

Are you sure this is right? Simply casting an unsigned number to
signed won't miraculously give it a negative value...

>                        return NULL;
>  #endif
>                return info->id_to_module[id];
> _______________________________________________
> devel mailing list
> devel@xxxxxxxxxxxxxxxxxxxxxx
> http://driverdev.linuxdriverproject.org/mailman/listinfo/devel
>



-- 
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux