>  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. ?


_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel

Reply via email to