base-hw: add explicit array-bounds check

This patch rules out out-of-bounds array accesses without inspecting the
caller. It is not a bug fix but adds clarity.
This commit is contained in:
Norman Feske 2020-01-07 17:45:44 +01:00 committed by Christian Helmuth
parent de764d8490
commit beb8bf498c

View File

@ -422,6 +422,9 @@ class Hw::Page_table
size_t const size, Page_flags const & flags,
Allocator & alloc)
{
if (i > MAX_INDEX)
return;
using Pt = Page_table_level_2;
using Ptd = Page_table_descriptor;