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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>  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
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux