lkml.org 
[lkml]   [2000]   [Aug]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectFW: [CHECKER] null ptr checking
Date
[3rd time's a charm]

> Hi Everyone,

> I'm Wallace, another member of Dawson's group, and I've been working on
> a
> checker that make sure folks check return values from allocation
> functions
> for NULL before using. I believe Dawson sent out a log with respect to
> just kmalloc/vmalloc; I've expanded it to include others.
>
> Right now, we're just using the obvious "if it's named alloc" heuristic
> to
> find new functions, but if any of you are aware of other ones that don't
> fall in this category, please let me know.
>
> There are a few false positives. Some are due to kprintf's and the
> like,
> and this has already been fixed. The rest involve freeing on error
> paths, which I'll also fix shortly.
>
> We're working on identifying more functions that can return NULL
> pointers,
> as well as coupling alloc's with their respective free's. Again, if you
> have any heurstics about identifying such pairings, I would appreciate
> your input.

Hi Wallace,

I looked at all of these drivers/usb/* warnings and they are all OK in
2.4.0-test7-pre7. I'm not planning to check 2.3.99.

I believe that most of these are OK because the checker tool can't
(doesn't) recognize that a called function can (does) free the allocated
memory instead of it being freed in the same function.

The itemized USB list is below if you care to see it.

Thanks for your work on this and the other checkers.

~Randy

--------------------------------------------------
/u3/whuang/mc/linux-2.3.99/drivers/usb/devio.c:120:my_usb_control_msg:
ERROR: did not free urb on error path
It's OK now.
/u3/whuang/mc/linux-2.3.99/drivers/usb/devio.c:755:proc_submiturb:
ERROR: did not free as on error path
It's OK now.
/u3/whuang/mc/linux-2.3.99/drivers/usb/devio.c:784:proc_submiturb:
ERROR: did not free as on error path
It's OK now.

/u3/whuang/mc/linux-2.3.99/drivers/usb/mdc800.c:917:usb_mdc800_init:
ERROR: did not free mdc800 on error path
It's OK now.

/u3/whuang/mc/linux-2.3.99/drivers/usb/plusb.c:391:plusb_alloc: ERROR:
did not free s on error path
<s> wasn't allocated here;
it calls a function to free s->fields;

/u3/whuang/mc/linux-2.3.99/drivers/usb/usb-ohci.c:1738:hc_start: ERROR:
did not free usb_dev on error path
calls a function to free it;
/u3/whuang/mc/linux-2.3.99/drivers/usb/usb-ohci.c:1891:hc_found_ohci:
ERROR: did not free ohci on error path
calls a function to free it;
/u3/whuang/mc/linux-2.3.99/drivers/usb/usb-ohci.c:1918:hc_found_ohci:
ERROR: did not free ohci on error path
calls a function to free it;

/u3/whuang/mc/linux-2.3.99/drivers/usb/usb-uhci.c:2631:uhci_start_usb:
ERROR: did not free usb_dev on error path
calls a function to free it;
/u3/whuang/mc/linux-2.3.99/drivers/usb/usb-uhci.c:2729:alloc_uhci:
ERROR: did not free bus on error path
calls a function to free it;
/u3/whuang/mc/linux-2.3.99/drivers/usb/usb-uhci.c:2745:alloc_uhci:
ERROR: did not free bus on error path
calls a function to free it;
/u3/whuang/mc/linux-2.3.99/drivers/usb/usb-uhci.c:2752:alloc_uhci:
ERROR: did not free bus on error path
calls a function to free it;
--------------------------------------------------


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

\
 
 \ /
  Last update: 2005-03-22 12:37    [W:0.029 / U:3.164 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site