small bug in 2.1.103 fs/proc/array.c

Tigran Aivazian (tigran@sco.COM)
Thu, 21 May 1998 12:19:18 +0100 (BST)


Hello,

Yesterday I was browsing 2.1.102 source and found what I believe to be a
bug (unless there is something clever gcc-optimization-related stuff is
going on that I don't understand). However, I did not report it because I
assumed it to be so obvious that 2.1.103 will probably fix it. But it did
not, so here is the source:

static int get_statm(int pid, char * buffer)
{
struct task_struct *tsk = find_task_by_pid(pid);
~~~~~~~~~~~~~~~~~~~~~~~~
int size=0, resident=0, share=0, trs=0, lrs=0, drs=0, dt=0;

read_lock(&tasklist_lock);
tsk = find_task_by_pid(pid);

Since the correct way to call find_task_by_pid() is probably after
read_lock(&tasklist_lock) the first initialisation of tsk is unnecessary.

Am I missing something?

Thanks,
Tigran.

-----------------------------------------------------
Tigran A. Aivazian | http://www.sco.com/
Escalations Research Group | Email: tigran@sco.com
Santa Cruz Operation Ltd | Ext: 6796
United Kingdom |

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu