bug-hurd
[Top][All Lists]
Advanced

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

Re: [PATCH 01/14] term: fix error handling in hurdio_mdmctl


From: Samuel Thibault
Subject: Re: [PATCH 01/14] term: fix error handling in hurdio_mdmctl
Date: Sat, 9 Nov 2013 18:44:20 +0100
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

Justus Winter, le Fri 08 Nov 2013 21:24:09 +0100, a écrit :
> hurdio_mdmctl allows one to set and clear bits from the modem control
> bit vector. However, plausible code paths exist that leave oldbits
> uninitialized. Fix this by returning an error instead if retrieving
> the oldbits failed and the bit set or clear operation was selected.
> 
> Found using the Clang Static Analyzer.
> 
> * term/hurdio.c (hurdio_mdmctl): Fix error handling.
> ---
>  term/hurdio.c |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/term/hurdio.c b/term/hurdio.c
> index 357ab38..e9e80e9 100644
> --- a/term/hurdio.c
> +++ b/term/hurdio.c
> @@ -585,10 +585,15 @@ hurdio_mdmctl (int how, int bits)
>           {
>             error_t err = tioctl_tiocmodg (ioport, &oldbits);
>             if (err && (err == EMIG_BAD_ID || err == EOPNOTSUPP))
> -             tioc_caps &= ~TIOC_CAP_MODG;
> +             {
> +               tioc_caps &= ~TIOC_CAP_MODG;
> +               return err;

I'd rather always return EOPNOTSUPP, EMIG_BAD_ID would make the caller
believe that it's the term translator which doesn't even know the RPC.

Otherwise, Aack.

> +             }
>             else if (err)
>               return err;
>           }
> +       else
> +         return EOPNOTSUPP;
>       }
>  
>        if (how == MDMCTL_BIS)
> -- 
> 1.7.10.4
> 
> 

-- 
Samuel
 RM> Mauvais OS, changer d'OS (c)(r)(tm)
 J'ai windows 98 et comment faire pour changer l'os de windows 98?
 Dans ajout et suppression du programme et il ne parle pas d'os.
 -+- DN in : GNU -+- L'O.S. est las, hélas, c'est là qu'est l'os -+-



reply via email to

[Prev in Thread] Current Thread [Next in Thread]