From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH]: xarray: Fix potential out of bounds access
Date: Mon, 14 Jan 2019 21:47:41 +0300 [thread overview]
Message-ID: <20190114184741.GF17906@uranus.lan> (raw)
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 */
next reply other threads:[~2019-01-14 18:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-14 18:47 Cyrill Gorcunov [this message]
2019-01-14 19:01 ` [PATCH]: xarray: Fix potential out of bounds access Matthew Wilcox
2019-01-14 19:14 ` Cyrill Gorcunov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190114184741.GF17906@uranus.lan \
--to=gorcunov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.