Skip to content

Commit

Permalink
Fix for the validation of the bits located in the least signficant
Browse files Browse the repository at this point in the history
bits of mem_section.section_mem_map pointers.  Without the patch,
the validation functions always returned valid, due to a coding
error found by clang.  However, it was never really a problem
because it is extremely unlikely that an existing mem_section would
ever be invalid.
(oleksandr@redhat.com, anderson@redhat.com)
  • Loading branch information
Dave Anderson committed Oct 27, 2017
1 parent d390969 commit e81db08
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions memory.c
Expand Up @@ -17003,20 +17003,26 @@ valid_section(ulong addr)

if ((mem_section = read_mem_section(addr)))
return (ULONG(mem_section +
OFFSET(mem_section_section_mem_map)) &&
SECTION_MARKED_PRESENT);
OFFSET(mem_section_section_mem_map))
& SECTION_MARKED_PRESENT);
return 0;
}

int
section_has_mem_map(ulong addr)
{
char *mem_section;
ulong kernel_version_bit;

if (THIS_KERNEL_VERSION >= LINUX(2,6,24))
kernel_version_bit = SECTION_HAS_MEM_MAP;
else
kernel_version_bit = SECTION_MARKED_PRESENT;

if ((mem_section = read_mem_section(addr)))
return (ULONG(mem_section +
OFFSET(mem_section_section_mem_map))
&& SECTION_HAS_MEM_MAP);
& kernel_version_bit);
return 0;
}

Expand Down

0 comments on commit e81db08

Please sign in to comment.