Re: [PATCH]: xarray: Fix potential out of bounds access

2019-01-14 Thread Cyrill Gorcunov
On Mon, Jan 14, 2019 at 11:01:20AM -0800, Matthew Wilcox wrote: > On Mon, Jan 14, 2019 at 09:47:41PM +0300, Cyrill Gorcunov wrote: > > Since the mark is used as an array index we should use > > preincrement to not access the XA_MARK_MAX index. > > But XA_MARK_MAX is inclusive: > > include/linux/x

Re: [PATCH]: xarray: Fix potential out of bounds access

2019-01-14 Thread Matthew Wilcox
On Mon, Jan 14, 2019 at 09:47:41PM +0300, Cyrill Gorcunov wrote: > Since the mark is used as an array index we should use > preincrement to not access the XA_MARK_MAX index. But XA_MARK_MAX is inclusive: include/linux/xarray.h:#define XA_MARK_MAX XA_MARK_2 so we actually want to acc

[PATCH]: xarray: Fix potential out of bounds access

2019-01-14 Thread Cyrill Gorcunov
Since the mark is used as an array index we should use preincrement to not access the XA_MARK_MAX index. Cc: Matthew Wilcox Signed-off-by: Cyrill Gorcunov --- Matthew, take a look please, I suspect we may access the mark index out of allocated one. Compile tested only. It comes from 58d6ea3085f2