[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100624100948.6446f8bd@lxorguk.ukuu.org.uk>
Date: Thu, 24 Jun 2010 10:09:48 +0100
From: Alan Cox <alan@...rguk.ukuu.org.uk>
To: Henri Häkkinen <henuxd@...il.com>
Cc: gregkh@...e.de, ossama.othman@...el.com, alan@...ux.intel.com,
mattij.lammi@...il.com, randy.dunlap@...cle.com,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] Staging: memrar: Fixed memrar_handler.c
> 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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists