[PATCH 11/12] b1553brm.c: Fix Unsigned compared against 0 (CID #1399773)

Gedare Bloom gedare at rtems.org
Fri Mar 5 15:12:11 UTC 2021


On Thu, Mar 4, 2021 at 12:50 PM Ryan Long <thisisryanlong at gmail.com> wrote:
>
> CID 1399773: Unsigned compared against 0 in brm_write().
>
> Closes #4295
> ---
>  bsps/shared/grlib/1553/b1553brm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/bsps/shared/grlib/1553/b1553brm.c b/bsps/shared/grlib/1553/b1553brm.c
> index 694f585..484ee6d 100644
> --- a/bsps/shared/grlib/1553/b1553brm.c
> +++ b/bsps/shared/grlib/1553/b1553brm.c
> @@ -982,7 +982,7 @@ static rtems_device_driver brm_write(rtems_device_major_number major, rtems_devi
>
>         rw_args->bytes_moved = count;
>
> -       if (count >= 0) {
> +       if (count > 0) {
>                 return RTEMS_SUCCESSFUL;
>         }
I guess this code assumes the requested count to write is > 0 too?
(A request to write 0 bytes is successful if one writes 0 bytes.)

>         return RTEMS_UNSATISFIED;
> --
> 1.8.3.1
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list