Bug 13457 - found overlapping data buffer
Summary: found overlapping data buffer
Status: RESOLVED WILL_NOT_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: USB (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Greg Kroah-Hartman
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-04 16:05 UTC by Martin Ettl
Modified: 2009-06-04 21:19 UTC (History)
0 users

See Also:
Kernel Version: 2.6.29.3
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Martin Ettl 2009-06-04 16:05:45 UTC
Hello,

i detected an overlapping data buffer at file 
"linux-2.6.29.3/drivers/usb/atm/usbatm.c"
For detection, i used the static code analysis tool cppcheck. It prints the
following message:
[linux-2.6.29.3/drivers/usb/atm/usbatm.c:1393]: (error) Overlapping data buffer buffer


Take a loop at file usbatm.cat line 1393:

      	sprintf(buffer, "%s %2.2x", buffer, data[i]);

Here, var "buffer" is used by iteself, this is dangerous!!!!

Best regards

Ettl Martin
Comment 1 Greg Kroah-Hartman 2009-06-04 16:23:49 UTC
On Thu, Jun 04, 2009 at 04:05:46PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> Take a loop at file usbatm.cat line 1393:
> 
>           sprintf(buffer, "%s %2.2x", buffer, data[i]);
> 
> Here, var "buffer" is used by iteself, this is dangerous!!!!

This is only a debugging message, and only happens if you build the
driver to enable that debugging (which is not the default).

If this bothers you, can you provide a patch and send it to the
linux-usb mailing list to use the standard kernel functions to output
hex data like this and not open-code it?
Comment 2 Martin Ettl 2009-06-04 21:04:09 UTC
Thank you for the fast reply. I know, this is only activated on debugging. But, no offense, debugging with obviously wrong code is a bad idea (just my opinion)!

I have no time to submit a patch.

Best regards

Martin
Comment 3 Greg Kroah-Hartman 2009-06-04 21:19:31 UTC
Ok, will just close this out for now then.

Note You need to log in before you can comment on or make changes to this bug.