diff options
author | Julia Lawall <julia@diku.dk> | 2009-07-04 11:31:47 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-07-05 18:03:30 -0700 |
commit | 3942453948015228d6b1ae9835a6f6ca3e842aaa (patch) | |
tree | d409b9a94a6e8305e43c11d535897f4ccf712ea3 /drivers/staging | |
parent | 4c3dd308adbda61f2ab46a14a0adcca8e1338ea5 (diff) |
drivers/net/smsc911x.c: Fix resource size off by 1 error
The call resource_size(res) returns res->end - res->start + 1 and thus the
second change is semantics-preserving. res_size is then used as the second
argument of a call to request_mem_region, and the memory allocated by this
call appears to be the same as what is released in the two calls to
release_mem_region. So the size argument for those calls should be
resource_size(size) as well. Alternatively, in the second call to
release_mem_region, the second argument could be res_size, as that variable
has already been initialized at the point of this call.
The problem was found using the following semantic patch:
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@@
struct resource *res;
@@
- (res->end - res->start) + 1
+ resource_size(res)
@@
struct resource *res;
@@
- res->end - res->start
+ BAD(resource_size(res))
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/staging')
0 files changed, 0 insertions, 0 deletions