From e1d97d88caa8c52b0134f7333f042b89c189085e Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Thu, 12 Mar 2020 15:04:07 +0800 Subject: [PATCH] loader: use all 24 bits for IniE size Because ELF files can operate at byte offsets, we must use the full byte-addressible address for sections. Signed-off-by: Sean Cross --- loader/src/main.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/loader/src/main.rs b/loader/src/main.rs index 7ebad226d..0ad9bdb36 100644 --- a/loader/src/main.rs +++ b/loader/src/main.rs @@ -155,9 +155,7 @@ pub struct MiniElfSection { impl MiniElfSection { pub fn len(&self) -> usize { // Strip off the top four bits, which contain the flags. - // Also shift everything up by two bits, since it's in - // units of 32-bit words. - let len = (self.size_and_flags << 2) & !0xf000_0000; + let len = self.size_and_flags & !0xff00_0000; len as usize }