All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH]: xarray: Fix potential out of bounds access
@ 2019-01-14 18:47 Cyrill Gorcunov
  2019-01-14 19:01 ` Matthew Wilcox
  0 siblings, 1 reply; 3+ messages in thread
From: Cyrill Gorcunov @ 2019-01-14 18:47 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: LKML

Since the mark is used as an array index we should use
preincrement to not access the XA_MARK_MAX index.

Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
Matthew, take a look please, I suspect we may access the
mark index out of allocated one. Compile tested only.
It comes from 58d6ea3085f2e53714810a513c61629f6d2be0a6

 lib/xarray.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-next.git/lib/xarray.c
===================================================================
--- linux-next.git.orig/lib/xarray.c
+++ linux-next.git/lib/xarray.c
@@ -129,7 +129,7 @@ static void xas_squash_marks(const struc
 			continue;
 		__set_bit(xas->xa_offset, marks);
 		bitmap_clear(marks, xas->xa_offset + 1, xas->xa_sibs);
-	} while (mark++ != (__force unsigned)XA_MARK_MAX);
+	} while (++mark != (__force unsigned)XA_MARK_MAX);
 }
 
 /* extracts the offset within this node from the index */

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-01-14 19:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-14 18:47 [PATCH]: xarray: Fix potential out of bounds access Cyrill Gorcunov
2019-01-14 19:01 ` Matthew Wilcox
2019-01-14 19:14   ` Cyrill Gorcunov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.