Re: [CHECKER] repetitive/contradictory comparison bugs for 2.4.7

From: Alan Cox (alan@lxorguk.ukuu.org.uk)
Date: Wed Jul 25 2001 - 08:34:36 EST


> other 10 are questionable. Those 10 are all simple variations on the
> following code:
>
> Start --->
> if (!tmp_buf) {
> page = get_free_page(GFP_KERNEL);
>
> Error --->
> if (tmp_buf)
> free_page(page);
> else
> tmp_buf = (unsigned char *) page;
> }

That one is not a bug. The serial drivers do this to handle a race. Really
it should be

                page = get_free_page(GFP_KERNEL)

                rmb();
                if (tmp_buf)
                        ..

but this will go away as and when someone switches the tty layer to new
style locking. The precise code flow (under lock_kernel in both cases) is

        
        if (!tmp_buf)
        {
                /* tmp_buf was 0
                page = get_free_page (...)
                [SLEEPS, TASK SWITCH]

                if(tmp_buf)
                /* tmp buf was non zero - another thread allocated it */

Alan
-
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/



This archive was generated by hypermail 2b29 : Tue Jul 31 2001 - 21:00:22 EST