Re: [PATCH 03/18] fs_context: fix detecting full log buffer

2018-07-09 Thread David Howells
David Howells 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 -

Re: [PATCH 03/18] fs_context: fix detecting full log buffer

2018-07-09 Thread David Howells
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