Skip to contentSkip to conversation

Make set_wrprotect() value safe

PATCH In review Zachary Amsden 2 participants 2 messages Aug 24, 2005 Generic include/asm header files

lore
Share & tools
lore
#0 lore raw

PATCH 3/5 Make set_wrprotect() value safe

The macro set_wrprotect() should not be defined to have a value. Make it a do {} while(0) instead of ({}).
Noticed by Chris Wright.

Patch-subject: Make set_wrprotect() value safe
Index: linux-2.6.13/include/asm-generic/pgtable.h
===================================================================

include/asm-generic/pgtable.h +2 -2
@@ -314,11 +314,11 @@ do {									\
 
 #ifndef __HAVE_ARCH_PTEP_SET_WRPROTECT
 #define ptep_set_wrprotect(__mm, __address, __ptep)			\
-({									\
+do {									\
 	pte_t __old_pte = *(__ptep);					\
 	set_pte_at((__mm), (__address), (__ptep),			\
 			pte_wrprotect(__old_pte));			\
-})
+} while (0)
 #endif
 
 #ifndef __HAVE_ARCH_PTE_SAME
#1 lore raw
Quoted 3 lines · * Zachary Amsden ([email protected]) wrote:

The macro set_wrprotect() should not be defined to have a value. Make it a do {} while(0) instead of ({}).
Noticed by Chris Wright.

I already fixed that one in the virt-2.6 git tree.

thanks,
-chris