staging: gasket: page_table: use total_entries for max ext lvl0 page idx
authorNick Ewalt <nicholasewalt@google.com>
Mon, 17 Sep 2018 12:39:04 +0000 (05:39 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 Sep 2018 11:22:01 +0000 (13:22 +0200)
The maximum number of entries in the page table is configurable at
initialization time and should be used in gasket_extended_lvl0_page_idx.

Signed-off-by: Nick Ewalt <nicholasewalt@google.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/gasket/gasket_page_table.c

index 779ad2f23ef9b7af0dd0e7379b8129e4a086d8e6..8364b49f147c2c45c8d26934a6af131ebef40a6d 100644 (file)
@@ -562,7 +562,7 @@ static ulong gasket_extended_lvl0_page_idx(struct gasket_page_table *pg_tbl,
                                           ulong dev_addr)
 {
        return (dev_addr >> GASKET_EXTENDED_LVL0_SHIFT) &
-              ((1 << GASKET_EXTENDED_LVL0_WIDTH) - 1);
+               (pg_tbl->config.total_entries - 1);
 }
 
 /*