[Crash-utility] Small fix for pages_scanned value

Dave Anderson anderson at redhat.com
Tue Jan 20 15:08:26 UTC 2015



----- Original Message -----
> Hi Dave,
> 
> there seems to be typo while printing pages_scanned value - signed output for
> unsigned variable.
> 
> Patch:
> --- crash-7.0.9.orig/memory.c	2014-11-13 15:33:40.000000000 -0500
> +++ crash-7.0.9/memory.c	2015-01-20 05:19:07.000000000 -0500
> @@ -15776,7 +15776,7 @@ dump_zone_stats(void)
>  			if (VALID_MEMBER(zone_pages_scanned)) {
>  				value1 = ULONG(zonebuf +
>  					OFFSET(zone_pages_scanned));
> -				fprintf(fp, "PAGES_SCANNED: %ld  ", value1);
> +				fprintf(fp, "PAGES_SCANNED: %lu  ", value1);
>  			}
>  			fprintf(fp, "\n");
> 

I guess that's fine, but at least on more recent kernels, that code doesn't 
even get executed because of the goto line above it:

                       } else {
                                if (VALID_MEMBER(zone_vm_stat)) {
                                        fprintf(fp, "\n  VM_STAT:\n");
                                        dump_vm_stat(NULL, NULL, node_zones +
                                                OFFSET(zone_vm_stat));
                                } else
                                        fprintf(fp, "  FREE: %ld\n", value5);
                                goto next_zone;
                        }

I'm pretty that is an error, where the all_unreclaimable and pages_scanned displays
were added after the code above.  I'll remove the goto and test it on a couple 
hundred dumps of various versions to verify it.

Dave




More information about the Crash-utility mailing list