Bug 8005 - a possible bug in "usb/gadget/inode.c"
Summary: a possible bug in "usb/gadget/inode.c"
Alias: None
Product: Drivers
Classification: Unclassified
Component: USB (show other bugs)
Hardware: i386 Linux
: P2 normal
Assignee: Greg Kroah-Hartman
Depends on:
Blocks: USB
  Show dependency tree
Reported: 2007-02-14 00:20 UTC by Lingxiao Jiang
Modified: 2008-09-22 11:37 UTC (History)
1 user (show)

See Also:
Kernel Version: 2.6.20
Tree: Mainline
Regression: ---


Description Lingxiao Jiang 2007-02-14 00:20:12 UTC
Most recent kernel where this bug did *NOT* occur: no

Problem Description: If take a look at the code at lines 399-428 and lines
443-473  in "drivers/usb/gadget/inode.c", one can see the two pieces of code are
similar, although one is for "read" and the other is for "write". However, the
two "if" conditions at line 399 and 443 are complementing each other; it seems
that one of them is doing a "wrong" direction.

Also, line 460 may use a "unlikely", just like line 416, for a little better

Suggested fix: negate the condition at line 443; add "unlikely" at line 460.

Comment 1 Natalie Protasevich 2008-02-14 22:51:35 UTC
Lingxiao, this is almost a policy to submit a patch when the code seems wrong, not to open a bugzilla :) Would you like to submit the patch to linux-usb@vger.kernel.org?

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