[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <10922.1531128946@warthog.procyon.org.uk>
Date: Mon, 09 Jul 2018 10:35:46 +0100
From: David Howells <dhowells@...hat.com>
To: unlisted-recipients:; (no To-header on input)
Cc: dhowells@...hat.com, Eric Biggers <ebiggers3@...il.com>,
Alexander Viro <viro@...iv.linux.org.uk>,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
Eric Biggers <ebiggers@...gle.com>
Subject: Re: [PATCH 03/18] fs_context: fix detecting full log buffer
David Howells <dhowells@...hat.com> wrote:
> > When 'head' and 'tail' wrap around, 'log->head - log->tail' will be
> > something like '4 - 252 = -248', and comparing that directly to the
> > array size is wrong. Fix by casting to 'u8'.
>
> I think a better fix is to use CIRC_CNT() or CIRC_SPACE().
Or it would be - if CIRC_CNT() and CIRC_SPACE() didn't leave a hole in the
buffer - but that's unnecessary if the head and tail counters can hold 2x the
ring size or more.
David
Powered by blists - more mailing lists