Skip to contentSkip to conversation

remove redundant variable in sys_prctl

PATHC Jesper Juhl 1 participant 2 messages Aug 9, 2005

lore
Share & tools
lore
#0 lore raw

The `sig' variable in kernel/sys.c::sys_prctl() is completely redundant, we might as well get rid of it.
Patch below for review (also attached since gmail's webmail interface will most certainly mangle the inline one).

---

kernel/sys.c 2005-08-09 13:35:40.000000000 +0200 renamed from kernel/sys.c~ 2005-08-09 13:35:40.000000000 +0200 +2 -4
@@ -1711,7 +1711,6 @@ asmlinkage long sys_prctl(int option, un
                          unsigned long arg4, unsigned long arg5)
 {
        long error;
-       int sig;
 
        error = security_task_prctl(option, arg2, arg3, arg4, arg5);
        if (error)
@@ -1719,12 +1718,11 @@ asmlinkage long sys_prctl(int option, un
 
        switch (option) {
                case PR_SET_PDEATHSIG:
-                       sig = arg2;
-                       if (!valid_signal(sig)) {
+                       if (!valid_signal(arg2)) {
                                error = -EINVAL;
                                break;
                        }
-                       current->pdeath_signal = sig;
+                       current->pdeath_signal = arg2;
                        break;
                case PR_GET_PDEATHSIG:
                        error = put_user(current->pdeath_signal, (int

__user *)arg2);

Signature · 3 lines
Jesper Juhl <[email protected]>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html
kernel/sys.c renamed from kernel/sys.c~ +2 -4
@@ -1711,7 +1711,6 @@ asmlinkage long sys_prctl(int option, un
 			  unsigned long arg4, unsigned long arg5)
 {
 	long error;
-	int sig;
 
 	error = security_task_prctl(option, arg2, arg3, arg4, arg5);
 	if (error)
@@ -1719,12 +1718,11 @@ asmlinkage long sys_prctl(int option, un
 
 	switch (option) {
 		case PR_SET_PDEATHSIG:
-			sig = arg2;
-			if (!valid_signal(sig)) {
+			if (!valid_signal(arg2)) {
 				error = -EINVAL;
 				break;
 			}
-			current->pdeath_signal = sig;
+			current->pdeath_signal = arg2;
 			break;
 		case PR_GET_PDEATHSIG:
 			error = put_user(current->pdeath_signal, (int __user *)arg2);
#1 lore raw
Quoted 33 lines · Jesper Juhl

The `sig' variable in kernel/sys.c::sys_prctl() is completely redundant, we might as well get rid of it.
Patch below for review (also attached since gmail's webmail interface will most certainly mangle the inline one).

---

kernel/sys.c 2005-08-09 13:35:40.000000000 +0200 renamed from kernel/sys.c~ 2005-08-09 13:35:40.000000000 +0200 +2 -4
@@ -1711,7 +1711,6 @@ asmlinkage long sys_prctl(int option, un
                          unsigned long arg4, unsigned long arg5)
 {
        long error;
-       int sig;
 
        error = security_task_prctl(option, arg2, arg3, arg4, arg5);
        if (error)
@@ -1719,12 +1718,11 @@ asmlinkage long sys_prctl(int option, un
 
        switch (option) {
                case PR_SET_PDEATHSIG:
-                       sig = arg2;
-                       if (!valid_signal(sig)) {
+                       if (!valid_signal(arg2)) {
                                error = -EINVAL;
                                break;
                        }
-                       current->pdeath_signal = sig;
+                       current->pdeath_signal = arg2;
                        break;
                case PR_GET_PDEATHSIG:
                        error = put_user(current->pdeath_signal, (int
Quoted 3 lines

__user *)arg2);

There is a slight difference made by this patch. since arg2 is 'unsigned long' and sig was a 'signed int', for sufficiently large values the assignment to the signed int variable would have changed the value. Does this matter? I don't think it does, but it just hit me that it might..

Signature · 3 lines
Jesper Juhl <[email protected]>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html