* [PATCH] pktgen: sprintf arg type warning
@ 2004-10-09 3:30 Randy.Dunlap
2004-10-09 5:19 ` David S. Miller
0 siblings, 1 reply; 6+ messages in thread
From: Randy.Dunlap @ 2004-10-09 3:30 UTC (permalink / raw)
To: netdev; +Cc: davem
Fix sprintf arg type error (gcc 3.3.3), although it looks more like
a gcc problem than a kernel source code problem to me.
Doesn't matter on x86-32. Fixes a warning on x86-64.
net/core/pktgen.c:607: warning: long long unsigned int format, long unsigned int arg (arg 4)
Signed-off-by: Randy Dunlap <rddunlap@osdl.org>
diffstat:=
net/core/pktgen.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
diff -Naurp ./net/core/pktgen.c~pktgen_type ./net/core/pktgen.c
--- ./net/core/pktgen.c~pktgen_type 2004-10-06 15:04:06.260548504 -0700
+++ ./net/core/pktgen.c 2004-10-08 20:16:57.191340296 -0700
@@ -603,7 +603,7 @@ static void show_results(struct pktgen_i
do_div(idle, cpu_speed);
p += sprintf(p, "OK: %llu(c%llu+d%lu) usec, %llu (%dbyte,%dfrags)\n",
- total, total - idle, idle,
+ total, total - (__u64)idle, idle,
info->sofar, size, nr_frags);
pps = info->sofar * USEC_PER_SEC;
--
~Randy
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] pktgen: sprintf arg type warning
2004-10-09 3:30 [PATCH] pktgen: sprintf arg type warning Randy.Dunlap
@ 2004-10-09 5:19 ` David S. Miller
2004-10-09 17:30 ` Sam Leffler
2004-10-09 22:07 ` Randy.Dunlap
0 siblings, 2 replies; 6+ messages in thread
From: David S. Miller @ 2004-10-09 5:19 UTC (permalink / raw)
To: Randy.Dunlap; +Cc: netdev
On Fri, 8 Oct 2004 20:30:27 -0700
"Randy.Dunlap" <rddunlap@osdl.org> wrote:
>
> Fix sprintf arg type error (gcc 3.3.3), although it looks more like
> a gcc problem than a kernel source code problem to me.
> Doesn't matter on x86-32. Fixes a warning on x86-64.
>
> net/core/pktgen.c:607: warning: long long unsigned int format, long unsigned int arg (arg 4)
This won't fix the problem on sparc64 where u64 is an "unsigned long"
So, just cast the thing to the type gcc wants "unsigned long long"
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] pktgen: sprintf arg type warning
2004-10-09 5:19 ` David S. Miller
@ 2004-10-09 17:30 ` Sam Leffler
2004-10-09 17:36 ` Andi Kleen
2004-10-09 22:07 ` Randy.Dunlap
1 sibling, 1 reply; 6+ messages in thread
From: Sam Leffler @ 2004-10-09 17:30 UTC (permalink / raw)
To: David S. Miller; +Cc: Randy.Dunlap, netdev
David S. Miller wrote:
> On Fri, 8 Oct 2004 20:30:27 -0700
> "Randy.Dunlap" <rddunlap@osdl.org> wrote:
>
>
>>Fix sprintf arg type error (gcc 3.3.3), although it looks more like
>>a gcc problem than a kernel source code problem to me.
>>Doesn't matter on x86-32. Fixes a warning on x86-64.
>>
>>net/core/pktgen.c:607: warning: long long unsigned int format, long unsigned int arg (arg 4)
>
>
> This won't fix the problem on sparc64 where u64 is an "unsigned long"
> So, just cast the thing to the type gcc wants "unsigned long long"
>
Other systems have addressed this problem by extending printf with
portable %formats.
Sam
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] pktgen: sprintf arg type warning
2004-10-09 17:30 ` Sam Leffler
@ 2004-10-09 17:36 ` Andi Kleen
2004-10-09 17:49 ` Sam Leffler
0 siblings, 1 reply; 6+ messages in thread
From: Andi Kleen @ 2004-10-09 17:36 UTC (permalink / raw)
To: Sam Leffler; +Cc: David S. Miller, Randy.Dunlap, netdev
> Other systems have addressed this problem by extending printf with
> portable %formats.
Problem is that gcc -Wformat doesn't know the new format codes,
and in Linux we still have to support old gcc versions.
Standard trick is to cast to long.
-Andi
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] pktgen: sprintf arg type warning
2004-10-09 17:36 ` Andi Kleen
@ 2004-10-09 17:49 ` Sam Leffler
0 siblings, 0 replies; 6+ messages in thread
From: Sam Leffler @ 2004-10-09 17:49 UTC (permalink / raw)
To: Andi Kleen; +Cc: David S. Miller, Randy.Dunlap, netdev
Andi Kleen wrote:
>>Other systems have addressed this problem by extending printf with
>>portable %formats.
>
>
> Problem is that gcc -Wformat doesn't know the new format codes,
> and in Linux we still have to support old gcc versions.
Yes, gcc has been modified to understand the new %formats. That's the
advantage to distributing a full system and not just a kernel :)
>
> Standard trick is to cast to long.
>
> -Andi
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] pktgen: sprintf arg type warning
2004-10-09 5:19 ` David S. Miller
2004-10-09 17:30 ` Sam Leffler
@ 2004-10-09 22:07 ` Randy.Dunlap
1 sibling, 0 replies; 6+ messages in thread
From: Randy.Dunlap @ 2004-10-09 22:07 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
[-- Attachment #1: Type: text/plain, Size: 268 bytes --]
> This won't fix the problem on sparc64 where u64 is an "unsigned long"
> So, just cast the thing to the type gcc wants "unsigned long long"
Yep, I should have known that. New patch attached.
(Note: testing new mail client; hopefully it's not munged.)
--
~Randy
[-- Attachment #2: pktgen_type.patch --]
[-- Type: text/x-patch, Size: 790 bytes --]
Fix printk arg format warning:
net/core/pktgen.c:607: warning: long long unsigned int format, long unsigned int arg (arg 4)
Signed-off-by: Randy Dunlap <rddunlap@osdl.org>
diffstat:=
net/core/pktgen.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
diff -Naurp ./net/core/pktgen.c~pktgen_type ./net/core/pktgen.c
--- ./net/core/pktgen.c~pktgen_type 2004-10-06 15:04:06.260548504 -0700
+++ ./net/core/pktgen.c 2004-10-09 15:04:10.907452600 -0700
@@ -603,7 +603,7 @@ static void show_results(struct pktgen_i
do_div(idle, cpu_speed);
p += sprintf(p, "OK: %llu(c%llu+d%lu) usec, %llu (%dbyte,%dfrags)\n",
- total, total - idle, idle,
+ total, (unsigned long long)(total - idle), idle,
info->sofar, size, nr_frags);
pps = info->sofar * USEC_PER_SEC;
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-10-09 22:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-09 3:30 [PATCH] pktgen: sprintf arg type warning Randy.Dunlap
2004-10-09 5:19 ` David S. Miller
2004-10-09 17:30 ` Sam Leffler
2004-10-09 17:36 ` Andi Kleen
2004-10-09 17:49 ` Sam Leffler
2004-10-09 22:07 ` Randy.Dunlap
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).