]> git.baikalelectronics.ru Git - kernel.git/commit
XArray: Fix xas_next() with a single entry at 0
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 1 Jul 2019 21:03:29 +0000 (17:03 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 1 Jul 2019 21:11:16 +0000 (17:11 -0400)
commit859e05338b1e4b8015d7e1fe4fa0f99bb6bd901f
tree3a083d68dc7d4fdca445313c74852943fafbf7f4
parentb3a254280c80355616128668891234ee929c0a5b
XArray: Fix xas_next() with a single entry at 0

If there is only a single entry at 0, the first time we call xas_next(),
we return the entry.  Unfortunately, all subsequent times we call
xas_next(), we also return the entry at 0 instead of noticing that the
xa_index is now greater than zero.  This broke find_get_pages_contig().

Fixes: 919ed45c9c4e ("xarray: Step through an XArray")
Reported-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
lib/test_xarray.c
lib/xarray.c