Re: segmentation fault while loading modules

From: Jan Engelhardt
Date: Wed Mar 23 2005 - 01:51:01 EST


> int
> ksignal(int pid,int signum)
> {
> struct task_struct x;
> struct task_struct *p;
> /* run through the task list of linux until we find our pid */
> //for (p = &init_task ; (p = next_task(p)) != &init_task ; ){
> for (p = &x ; (p = next_task(p)) != &x ; ){
...

next_task(p) is defined (not in the sense of a macro, though) as
p->tasks.next
and your x is not initiailzed, so what do you expect next_task(x)
to do, if p->tasks... does not contain a valid value?

You want this:
for(p = &init_task; (p = next_task(p)) != &init_task; ) {
...
}


Jan Engelhardt
--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/