From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49262 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932466AbeGIJc4 (ORCPT ); Mon, 9 Jul 2018 05:32:56 -0400 From: David Howells In-Reply-To: <20180708210154.10423-4-ebiggers3@gmail.com> References: <20180708210154.10423-4-ebiggers3@gmail.com> <20180708210154.10423-1-ebiggers3@gmail.com> To: Eric Biggers Cc: dhowells@redhat.com, Alexander Viro , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Eric Biggers Subject: Re: [PATCH 03/18] fs_context: fix detecting full log buffer MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <10669.1531128774.1@warthog.procyon.org.uk> Date: Mon, 09 Jul 2018 10:32:54 +0100 Message-ID: <10670.1531128774@warthog.procyon.org.uk> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Eric Biggers 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(). David