From: Julia Lawall Date: Sat, 4 Jul 2009 11:31:47 +0000 (+0000) Subject: drivers/net/smsc911x.c: Fix resource size off by 1 error X-Git-Tag: v2.6.31-rc3~70^2~5 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3942453948015228d6b1ae9835a6f6ca3e842aaa;p=pandora-kernel.git 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/) // @@ struct resource *res; @@ - (res->end - res->start) + 1 + resource_size(res) @@ struct resource *res; @@ - res->end - res->start + BAD(resource_size(res)) // Signed-off-by: Julia Lawall Signed-off-by: David S. Miller --- Reading git-diff-tree failed