Skip to contentSkip to conversation

nfs/nfsstress/make_tree: Fix erroneous cast to void pointer

PATCH NAK Markos Chandras 4 participants 4 messages Jan 3, 2012 – Jan 4, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 19/21 nfs/nfsstress/make_tree: Fix erroneous cast to void pointer

Hi, please review the attached patch

Signature · 1 line
markos

From 3c4f375b923af0ddc64257afbecf1dd2c8efef17 Mon Sep 17 00:00:00 2001
From: Markos Chandras <[email protected]>
Date: Thu, 22 Dec 2011 15:17:34 +0000
Subject: [PATCH 19/21] nfs/nfsstress/make_tree: Fix erroneous cast to void pointer

---
 testcases/network/nfs/nfsstress/make_tree.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
testcases/network/nfs/nfsstress/make_tree.c +2 -2
index 02d0304..c51e75e 100644
@@ -202,7 +202,7 @@
 #define PTHREAD_EXIT(val)    do {\
 			exit_val = val; \
                         dprt("pid[%d]: exiting with %d\n", gettid(),exit_val); \
-			pthread_exit((void *)exit_val); \
+			pthread_exit((void *)&exit_val); \
 				} while (0)
 
 #define OPT_MISSING(prog, opt)   do{\
@@ -846,4 +846,4 @@ main(int	argc,		/* number of input parameters		      */
         }
     }
     return(0);
-}
\ No newline at end of file
+}
Signature · 1 line
1.7.1

------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reviewed-by on v1 19/21
#1 lore raw
Quoted 1 line · Markos Chandras

Hi, please review the attached patch

------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#2 lore raw
In reply to Markos Chandras
Quoted 1 line · On Tuesday 03 January 2012 08:24:34 Markos Chandras wrote:

Hi, please review the attached patch

NAK: this is how the pthread API works. you aren't passing a value by reference. they used a pointer rather than "long" or something as it's harder to fit a pointer into an integer rather than the other way around.

if you're getting a build time warning, try casting it to uintptr_t instead -mike

------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#3 lore raw

Hi!

Quoted 5 lines

NAK: this is how the pthread API works. you aren't passing a value by reference. they used a pointer rather than "long" or something as it's harder to fit a pointer into an integer rather than the other way around.

if you're getting a build time warning, try casting it to uintptr_t instead

Pretty much, you would pass a pointer to thread stack as a return value with this patch which is wrong for several reasons (and the stackframe woudn't most likely there when somebody else would touch this value).

The whole macro actually seems to be broken. It assigns local variable thread_exit which is defined as volatile and it looks to me like somebody had no clue how volatie works (at least at first sight).

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list