This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fixed warning-to-error on mismatched printf parameter in control.c



The attached patch fixes a simple parameter mismatch to printf that is
flagged as an error ("warnings treated as errors"). I'm not familiar
with how patches are submitted to Systemtap, so I've just included a
standard diff patch.

When running a recent Linux kernel (2.6.23-rc6) on a RHEL5 system &
using a downloaded Systemtap from CVS I ran into an error with the
following simple stap:

global n
probe module("*").function("dm_request") {
    print_backtrace()
    if (n++ > 100) exit()
}

The stap -vv output:

gcc -Wp,-MD,/tmp/stapFD3jSv/.stap_21d0b27b9a27703dee4a97075c341cf1_610.o.d  -nostdinc -isystem /usr/lib/gcc/ia64-redhat-linux/4.1.1/include -D__KERNEL__ -Iinclude  -include include/linux/autoconf.h -DHAVE_WORKING_TEXT_ALIGN -DHAVE_MODEL_SMALL_ATTRIBUTE -DHAVE_SERIALIZE_DIRECTIVE -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Os -pipe  -ffixed-r13 -mfixed-range=f12-f15,f32-f127 -falign-functions=32 -frename-registers -fno-optimize-sibling-calls -fomit-frame-pointer -g  -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign -freorder-blocks -Wno-unused -Werror -I"/usr/local/share/systemtap/runtime"     -DSTAPCONF_INODE_PRIVATE -DMODULE -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(stap_21d0b27b9a27703dee4a97075c341cf1_610)"  -D"KBUILD_MODNAME=KBUILD_STR(stap_21d0b27b9a27703dee4a97075c341cf1_610)" -c -o /tmp/stapFD3jSv/.tmp_stap_21d0b27b9a27703dee4a97075c341cf1_610.o /tmp/stapFD3jSv/stap_21d0b27b9a27703dee4a97075c341cf1_610.c
cc1: warnings being treated as errors
In file included from /usr/local/share/systemtap/runtime/transport/transport.c:66,
	     from /usr/local/share/systemtap/runtime/print.c:17,
	     from /usr/local/share/systemtap/runtime/runtime.h:88,
	     from /tmp/stapFD3jSv/stap_21d0b27b9a27703dee4a97075c341cf1_610.c:42:
/usr/local/share/systemtap/runtime/transport/control.c: In function '_stp_ctl_read_cmd':
/usr/local/share/systemtap/runtime/transport/control.c:221: warning: format '%d' expects type 'int', but argument 2 has type 'size_t'
make[1]: *** [/tmp/stapFD3jSv/stap_21d0b27b9a27703dee4a97075c341cf1_610.o] Error 1

Signed-off-by: Alan D. Brunelle <Alan.Brunelle@hp.com>
---
 runtime/transport/control.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/runtime/transport/control.c b/runtime/transport/control.c
index 6df9a8a..42f2306 100644
--- a/runtime/transport/control.c
+++ b/runtime/transport/control.c
@@ -218,7 +218,7 @@ _stp_ctl_read_cmd (struct file *file, char __user *buf, size_t count, loff_t *pp
 		/* we can't put it back on the queue because it will likely be out-of-order */
 		/* fortunately this should never happen */
 		/* FIXME need to mark this as a transport failure */
-		errk("Supplied buffer too small. count:%d len:%d\n", count, len);
+		errk("Supplied buffer too small. count:%d len:%d\n", (int)count, len);
 		return -EFAULT;
 	}
 
-- 
1.5.2.5


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]