Thread (10 messages) 10 messages, 3 authors, 2012-03-08

RE: [patch 4/7] [PATCH] ctcm: make ctcmpc debugging compilable

From: David Laight <hidden>
Date: 2012-03-07 12:20:59
Also in: linux-s390

quoted hunk ↗ jump to hunk
 static const struct xid2 init_xid = {
@@ -132,7 +132,7 @@ void ctcmpc_dumpit(char *buf, int len)
 	__u32	ct, sw, rm, dup;
 	char	*ptr, *rptr;
 	char	tbuf[82], tdup[82];
-	#if (UTS_MACHINE == s390x)
+	#ifdef CONFIG_64BIT
 	char	addr[22];
 	#else
 	char	addr[12];
@@ -149,8 +149,8 @@ void ctcmpc_dumpit(char *buf, int len)
 
 	for (ct = 0; ct < len; ct++, ptr++, rptr++) {
 		if (sw == 0) {
-			#if (UTS_MACHINE == s390x)
-			sprintf(addr, "%16.16lx", (__u64)rptr);
+			#ifdef CONFIG_64BIT
+			sprintf(addr, "%16.16llx", (__u64)rptr);
 			#else
 			sprintf(addr, "%8.8X", (__u32)rptr);
 			#endif
What is wrong with:
	char addr[24];
	snprintf(addr, sizeof addr, "%p", rptr);

There seemed to be other 'dangerous' unbounded string
operations in that code as well.

	David
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help