Re: [patch] request_region / release_resource mixup

From: Jeff Garzik (jgarzik@mandrakesoft.com)
Date: Tue Feb 12 2002 - 01:49:57 EST


Marcus Alanen wrote:
>
> Hi, looking at region and resource handling I see that request_region
> allocates the struct resource with kmalloc() while request_resource
> takes it as a parameter. This means that release_region uses kfree()
> and release_resource doesn't.
>
> There are some drivers which mix this up by doing a request_region /
> release_resource pair, instead of the proper request_region /
> release_region. This leads to a memory leak.
>
> I've tried to fix this below. Comments? Output is from bk diff -u,
> not sure what the best command would've been.

Good patch, but a comment. When you replace release_resource(res) with
release_region(), you should also look and see if you can eliminate the
temporary variable 'res' too.

-- 
Jeff Garzik      | "I went through my candy like hot oatmeal
Building 1024    |  through an internally-buttered weasel."
MandrakeSoft     |             - goats.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Feb 15 2002 - 21:00:47 EST