xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org>
To: Daniel Kiper <daniel.kiper-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Cc: kexec-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	xen-devel-GuqFBffKawuULHF6PoxzQEEOCMrvLtNR@public.gmane.org,
	kumagai-atsushi-biTfD1RFvDe45+QrQBaojngSJqDPrsil@public.gmane.org
Subject: Re: [Xen-devel] [PATCH 5/7] Mute some compiler warnings
Date: Fri, 12 Jul 2013 15:12:08 +0100	[thread overview]
Message-ID: <51E00EB8.7050907@citrix.com> (raw)
In-Reply-To: <1373636895-31682-6-git-send-email-daniel.kiper-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>

On 12/07/13 14:48, Daniel Kiper wrote:
> This patch mutes follwing compiler warnings:
>   - warning: assignment discards ‘const’ qualifier from
>     pointer target type [enabled by default],
>   - warning: variable ‘page_offset’ set but not used
>     [-Wunused-but-set-variable].
>
> Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
> ---
>  dwarf_info.c  |    4 ++--
>  sadump_info.c |    2 --
>  2 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/dwarf_info.c b/dwarf_info.c
> index 6e21b8a..86cae69 100644
> --- a/dwarf_info.c
> +++ b/dwarf_info.c
> @@ -1427,7 +1427,7 @@ get_die_member(unsigned long long die_off, int index, long *offset,
>  	if (!get_data_member_location(die, offset))
>  		*offset = 0;
>  
> -	*name = dwarf_diename(die);
> +	*name = (char *)dwarf_diename(die);

Discarding a const qualifier like this is usually a good sign that you
are misusing name in the first place.

Indeed, name is merely non-const to strdup() and reuse the same variable.

This would be more clearly done using

const char * diename = dwarf_diename(&result) ;

and

name = strdup(diename);

~Andrew

>  	/*
>  	 * Duplicate the string before we pass it to eppic layer. The
>  	 * original string returned by dwarf layer will become invalid
> @@ -1513,7 +1513,7 @@ get_die_name(unsigned long long die_off)
>  		return NULL;
>  	}
>  
> -	name = dwarf_diename(&result);
> +	name = (char *)dwarf_diename(&result);
>  	if (name)
>  		name = strdup(name);
>  	clean_dwfl_info();
> diff --git a/sadump_info.c b/sadump_info.c
> index be6cf55..01cf5eb 100644
> --- a/sadump_info.c
> +++ b/sadump_info.c
> @@ -948,7 +948,6 @@ int
>  readpage_sadump(unsigned long long paddr, void *bufptr)
>  {
>  	unsigned long long pfn, block, whole_offset, perdisk_offset;
> -	ulong page_offset;
>  	int fd_memory;
>  
>  	if (si->kdump_backed_up &&
> @@ -957,7 +956,6 @@ readpage_sadump(unsigned long long paddr, void *bufptr)
>  		paddr += si->backup_offset - si->backup_src_start;
>  
>  	pfn = paddr_to_pfn(paddr);
> -	page_offset = paddr % info->page_size;
>  
>  	if (pfn >= si->sh_memory->max_mapnr)
>  		return FALSE;


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  parent reply	other threads:[~2013-07-12 14:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-12 13:48 [PATCH 0/7] Xen fixes and minor cleanups Daniel Kiper
     [not found] ` <1373636895-31682-1-git-send-email-daniel.kiper-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2013-07-12 13:48   ` [PATCH 1/7] xen: Improve calculation of beginning of virtual address space Daniel Kiper
2013-07-12 13:48   ` [PATCH 2/7] elf: Increase buf size in get_pt_note_info() Daniel Kiper
     [not found]     ` <1373636895-31682-3-git-send-email-daniel.kiper-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2013-07-12 14:04       ` [Xen-devel] " Andrew Cooper
     [not found]         ` <51E00CF9.7080604-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org>
2013-07-12 19:09           ` Daniel Kiper
2013-07-12 13:48   ` [PATCH 3/7] xen: Take into account new frame table address since Xen 4.3 Daniel Kiper
2013-07-12 13:48   ` [PATCH 4/7] xen: Enforce page size only when xen-syms file is used Daniel Kiper
2013-07-12 13:48   ` [PATCH 5/7] Mute some compiler warnings Daniel Kiper
     [not found]     ` <1373636895-31682-6-git-send-email-daniel.kiper-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2013-07-12 14:12       ` Andrew Cooper [this message]
2013-07-12 13:48   ` [PATCH 6/7] Use elf_getshdrstrndx() instead of elf_getshstrndx() Daniel Kiper
2013-07-12 13:48   ` [PATCH 7/7] Do not break progress messages Daniel Kiper
2013-07-12 14:01   ` [Xen-devel] [PATCH 0/7] Xen fixes and minor cleanups Andrew Cooper
     [not found]     ` <51E00C32.6090204-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org>
2013-07-12 14:30       ` Daniel Kiper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51E00EB8.7050907@citrix.com \
    --to=andrew.cooper3-sxgqhf6nn4dqt0dzr+alfa@public.gmane.org \
    --cc=daniel.kiper-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
    --cc=kexec-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=kumagai-atsushi-biTfD1RFvDe45+QrQBaojngSJqDPrsil@public.gmane.org \
    --cc=xen-devel-GuqFBffKawuULHF6PoxzQEEOCMrvLtNR@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).