* [PATCH] perf tools: fix type mismatch - long vs __statfs_word
@ 2014-08-13 17:03 Alexey Brodkin
2014-09-04 5:45 ` Vineet Gupta
2014-09-15 19:52 ` Arnaldo Carvalho de Melo
0 siblings, 2 replies; 4+ messages in thread
From: Alexey Brodkin @ 2014-08-13 17:03 UTC (permalink / raw)
To: linux-kernel
Cc: Alexey Brodkin, Vineet Gupta, Borislav Petkov, Jiri Olsa,
Cody P Schafer, Arnaldo Carvalho de Melo
>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".
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] perf tools: fix type mismatch - long vs __statfs_word
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
1 sibling, 1 reply; 4+ messages in thread
From: Vineet Gupta @ 2014-09-04 5:45 UTC (permalink / raw)
To: Alexey Brodkin, linux-kernel
Cc: Borislav Petkov, Jiri Olsa, Cody P Schafer,
Arnaldo Carvalho de Melo, peter Zijlstra,
Arnaldo Carvalho de Melo
+CC acme, Peter
On Wednesday 13 August 2014 10:34 PM, Alexey Brodkin wrote:
> 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".
>
> 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;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] perf tools: fix type mismatch - long vs __statfs_word
2014-09-04 5:45 ` Vineet Gupta
@ 2014-09-15 10:26 ` Alexey Brodkin
0 siblings, 0 replies; 4+ messages in thread
From: Alexey Brodkin @ 2014-09-15 10:26 UTC (permalink / raw)
To: acme, jolsa; +Cc: linux-kernel, dev, peterz, acme, bp, Vineet Gupta
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1116 bytes --]
Hi Arnaldo, Jiri,
> On Wednesday 13 August 2014 10:34 PM, Alexey Brodkin wrote:
> > 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".
> >
I'm wondering if there's a chance to get this patch accepted because for
now perf building from 3.15 kernels onward is broken.
Regards,
Alexey
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] perf tools: fix type mismatch - long vs __statfs_word
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 19:52 ` Arnaldo Carvalho de Melo
1 sibling, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2014-09-15 19:52 UTC (permalink / raw)
To: Alexey Brodkin
Cc: linux-kernel, Vineet Gupta, Borislav Petkov, Jiri Olsa,
Cody P Schafer, Arnaldo Carvalho de Melo
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-09-15 19:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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).