Skip to contentSkip to conversation

kill_proc_info_as_uid: don't use hardcoded constants

PATCH In review Oleg Nesterov 2 participants 2 messages Nov 23, 2005 – Nov 24, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kill_proc_info_as_uid: don't use hardcoded constants

Use symbolic names instead of hardcoded constants.

kernel/signal.c renamed from kernel/signal.c~1_KUID +1 -2
@@ -1163,8 +1163,7 @@ int kill_proc_info_as_uid(int sig, struc
 		ret = -ESRCH;
 		goto out_unlock;
 	}
-	if ((!info || ((unsigned long)info != 1 &&
-			(unsigned long)info != 2 && SI_FROMUSER(info)))
+	if ((info == SEND_SIG_NOINFO || (!is_si_special(info) && SI_FROMUSER(info)))
 	    && (euid != p->suid) && (euid != p->uid)
 	    && (uid != p->suid) && (uid != p->uid)) {
 		ret = -EPERM;
Acked-by on v1 1/1
#1 lore raw
Quoted 1 line · Oleg Nesterov

Use symbolic names instead of hardcoded constants.

I'm more than happy with that. Seems like the original code in check_kill_permission() was changed in a similar way after I made that _as_uid() function.

I don't think that I am a person with any say in the signal.c code,but in case of doubt:

Quoted 14 lines
kernel/signal.c renamed from kernel/signal.c~1_KUID +1 -2
@@ -1163,8 +1163,7 @@ int kill_proc_info_as_uid(int sig, struc
 		ret = -ESRCH;
 		goto out_unlock;
 	}
-	if ((!info || ((unsigned long)info != 1 &&
-			(unsigned long)info != 2 && SI_FROMUSER(info)))
+	if ((info == SEND_SIG_NOINFO || (!is_si_special(info) && SI_FROMUSER(info)))
 	    && (euid != p->suid) && (euid != p->uid)
 	    && (uid != p->suid) && (uid != p->uid)) {
 		ret = -EPERM;
Signature · 4 lines
- Harald Welte <[email protected]>          	        http://gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
                                                  (ETSI EN 300 175-7 Ch. A6)