lkml.org 
[lkml]   [2002]   [Aug]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    SubjectRe: [PATCH] 2.4.19 warnings cleanup
    From
       > --- linux/drivers/net/ppp_generic.c.orig	Sat Aug  3 17:13:58 2002
    > +++ linux/drivers/net/ppp_generic.c Sat Aug 3 19:11:54 2002
    > @@ -378,7 +378,7 @@
    > {
    > struct ppp_file *pf = file->private_data;
    > DECLARE_WAITQUEUE(wait, current);
    > - ssize_t ret;
    > + ssize_t ret = 0; /* suppress compiler warning */

    Please don't do this. I'm regularly having to fix drivers where people
    hid bugs this way rather than working out if it was a real problem. If
    it is genuinely a compiler corner case then let the gcc folks know and
    comment it but leave the warning.
    A compiler isn't able to work out the control flow which
    makes sure ret is indeed initialized on every path to
    a use. Solving such a problem is traveling salesman'ish :-)

    for (;;) {
    ...
    if (skb)
    break;
    ...
    set 'ret' to something
    more break statements
    }
    if (skb == 0)
    goto out; /* where 'ret' is used' */
    set 'ret' to something

    See? :-)
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:27    [W:0.022 / U:3.668 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site