[Crash-utility] [PATCH] Fix compile warnings

Dave Anderson anderson at redhat.com
Fri Nov 9 22:11:45 UTC 2007


Bernhard Walle wrote:
> This fixes compiler warnings with
> 
> -O2 -fmessage-length=0 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector \
>         -fno-builtin-memset -fno-strict-aliasing
> 
> Yes, for the one in get_lkcd_regs_for_cpu_v8() you can blame myself.
> 

The patch to calculate_load_order_v2() isn't compiler related,
right?  (it seems ok, but interesting that it's never been a
problem...)

Dave

> 
> Signed-off-by: Bernhard Walle <bwalle at suse.de>
> 
> ---
>  lkcd_common.c |    2 +-
>  lkcd_v8.c     |    4 +---
>  symbols.c     |    3 +++
>  3 files changed, 5 insertions(+), 4 deletions(-)
> 
> --- a/lkcd_common.c
> +++ b/lkcd_common.c
> @@ -1265,7 +1265,7 @@ lkcd_uncompress_gzip(unsigned char *dest
>  	unsigned char *source, ulong sourcelen)
>  {
>          ulong retlen = destlen;
> -        int rc;
> +        int rc = FALSE;
>  
>  	switch (uncompress(dest, &retlen, source, sourcelen)) 
>  	{
> --- a/lkcd_v8.c
> +++ b/lkcd_v8.c
> @@ -71,7 +71,7 @@ get_lkcd_regs_for_cpu_arch(int cpu, ulon
>  int
>  get_lkcd_regs_for_cpu_v8(struct bt_info *bt, ulong *eip, ulong *esp)
>  {
> -	int cpu;
> +	int cpu = bt->tc->processor;
>  
>  	if (!bt || !bt->tc) {
>  		fprintf(stderr, "get_lkcd_regs_for_cpu_v8: invalid tc "
> @@ -79,8 +79,6 @@ get_lkcd_regs_for_cpu_v8(struct bt_info 
>  		return -EINVAL;
>  	}
>  
> -	cpu = bt->tc->processor;
> -
>  	if (cpu >= NR_CPUS) {
>  		fprintf(stderr, "get_lkcd_regs_for_cpu_v8, cpu (%d) too high\n", cpu);
>  		return -EINVAL;
> --- a/symbols.c
> +++ b/symbols.c
> @@ -7538,6 +7538,9 @@ calculate_load_order_v2(struct load_modu
>  	char *secname;
>  	int i;
>  
> +	if ((store = bfd_make_empty_symbol(bfd)) == NULL)
> +		error(FATAL, "bfd_make_empty_symbol() failed\n");
> +
>  	s1 = lm->mod_symtable;
>  	s2 = lm->mod_symend;
>  	while (s1 < s2) {
> 
> --
> Crash-utility mailing list
> Crash-utility at redhat.com
> https://www.redhat.com/mailman/listinfo/crash-utility





More information about the Crash-utility mailing list