[Crash-utility] [PATCH RFC 00/14] Minor code cleanups, round zero

Dave Anderson anderson at redhat.com
Fri Oct 27 15:32:56 UTC 2017



----- Original Message -----
> ----- Original Message -----
> >
> > I'll take a look at these when I get the chance, but I'm really
> > not particularly excited unless they are actual bugs.
> 
> Like this one:
> 
> --- a/memory.c
> +++ b/memory.c
> @@ -17003,8 +17003,8 @@ 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;
>  }
>  
> @@ -17016,7 +17016,7 @@ section_has_mem_map(ulong addr)
>  	if ((mem_section = read_mem_section(addr)))
>  		return (ULONG(mem_section +
>  			OFFSET(mem_section_section_mem_map))
> -			&& SECTION_HAS_MEM_MAP);
> +			& SECTION_HAS_MEM_MAP);
>  	return 0;
>  }
> 
> This code has been like this since the original CONFIG_SPARSEMEM support
> patch was posted back in 2006.  Interesting that this has never been a
> problem.  Apparently nobody's ever bumped into mem_section that didn't
> have those flags.

Interestingly enough, this patch breaks RHEL5 and earlier kernels.
(try "kmem -n" with and without the patch).  Probably a flag issue with
earlier CONFIG_SPARSEMEM kernels.  

Dave




More information about the Crash-utility mailing list