Re: [PATCH 2/2] Staging: memrar: Fixed memrar_handler.c

From: Alan Cox
Date: Thu Jun 24 2010 - 05:05:21 EST


> size_t memrar_allocator_largest_free_area(struct memrar_allocator *allocator)
> {
> - if (allocator == NULL)
> - return 0;
> - return allocator->largest_free_area;
> + size_t tmp = 0;
> +
> + if (allocator != NULL) {
> + mutex_lock(&allocator->lock);
> + tmp = allocator->largest_free_area;
> + mutex_unlock(&allocator->lock);

This doesn't seem to make any sense (in either version). The moment you
drop the lock the value in "tmp" becomes stale as the allocator could
change it. ?


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/