linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
Cc: linux-kernel@vger.kernel.org,
	Vineet Gupta <Vineet.Gupta1@synopsys.com>,
	Borislav Petkov <bp@suse.de>, Jiri Olsa <jolsa@kernel.org>,
	Cody P Schafer <dev@codyps.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>
Subject: Re: [PATCH] perf tools: fix type mismatch - long vs __statfs_word
Date: Mon, 15 Sep 2014 16:52:01 -0300	[thread overview]
Message-ID: <20140915195201.GF2259@redhat.com> (raw)
In-Reply-To: <1407949429-25421-1-git-send-email-abrodkin@synopsys.com>

Em Wed, Aug 13, 2014 at 09:03:49PM +0400, Alexey Brodkin escreveu:
> >From "include/uapi/asm-generic/statfs.h" it is seen that "statfs.f_type" is of
> type "__statfs_word" which in its turn is "__u32" (unsigned int) for 32-bit
> systems.
> 
> So in case of compilation with "-Werror" following breakage happens:
> --->---
> fs.c: In function ‘fs__valid_mount’:
> fs.c:76:24: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
>   else if (st_fs.f_type != magic)
>                         ^
> cc1: all warnings being treated as errors
> --->---
> 
> Note that now when fs.c is in "lib/api/fs" and in "tools/lib/api/Makefile"
> CFLAGS has hard-coded "-Werror" this is inevitable even if one builds "perf"
> with "WERROR=0".

So we have one more case of comparision involving f_type:

[acme@zoo linux]$ find tools/ -type f | xargs grep -w f_type
tools/lib/api/fs/fs.c:	else if (st_fs.f_type != magic)
tools/lib/api/fs/debugfs.c:	else if (st_fs.f_type != (long) DEBUGFS_MAGIC)
[acme@zoo linux]$

Do we have to apply the same fix to that other case as well?
Interestingly it does it on a different way, that by your description
above would make it fail on 32-bit systems, no?

- Arnaldo
 
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> 
> Cc: Vineet Gupta <vgupta@synopsys.com>
> Cc: Borislav Petkov <bp@suse.de>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Cody P Schafer <dev@codyps.com>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
>  tools/lib/api/fs/fs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
> index c1b49c3..4b2fa7b 100644
> --- a/tools/lib/api/fs/fs.c
> +++ b/tools/lib/api/fs/fs.c
> @@ -75,7 +75,7 @@ static int fs__valid_mount(const char *fs, long magic)
>  
>  	if (statfs(fs, &st_fs) < 0)
>  		return -ENOENT;
> -	else if (st_fs.f_type != magic)
> +	else if ((long)st_fs.f_type != magic)
>  		return -ENOENT;
>  
>  	return 0;
> -- 
> 1.9.3

      parent reply	other threads:[~2014-09-15 19:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-13 17:03 [PATCH] perf tools: fix type mismatch - long vs __statfs_word Alexey Brodkin
2014-09-04  5:45 ` Vineet Gupta
2014-09-15 10:26   ` Alexey Brodkin
2014-09-15 19:52 ` Arnaldo Carvalho de Melo [this message]

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=20140915195201.GF2259@redhat.com \
    --to=acme@redhat.com \
    --cc=Alexey.Brodkin@synopsys.com \
    --cc=Vineet.Gupta1@synopsys.com \
    --cc=acme@kernel.org \
    --cc=bp@suse.de \
    --cc=dev@codyps.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.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).