Skip to contentSkip to conversation

Fix argument check for PR_SET_MM

PATCH Cyrill Gorcunov 1 participant 1 message Jan 23, 2012 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 17 lines · Michael Kerrisk

From: Michael Kerrisk <[email protected]>

Cyrill,

I imagine that the small operator fix below gives the behavior you intended. Please apply.

Thanks,

Michael

sys.c static int prctl_set_mm(int opt, unsigne · line 1709

Quoted 8 lines
sys.c renamed from sys.c.orig +1 -1
@@ -1703,7 +1703,7 @@ static int prctl_set_mm(int opt, unsigne
 	int error = 0;
 	struct mm_struct *mm = current->mm;
 
-	if (arg4 | arg5)
+	if (arg4 || arg5)
 		return -EINVAL;
 
 	if (!capable(CAP_SYS_ADMIN))

Hi Michael, thanks. But actually (arg4 | arg5) will give nonzero result if any of operands is not a zero ;) So no error here. From readability pov sure this will be clear. Thanks, I'll update.

Cyrill