I have a system call for the Linux kernel. When checking for null in an if statement, the process terminates:
unable to handle kernel null pointer reference at [position]
The faulty code below:
struct task_struct *task;
int found = 0;
if ((task = find_task_by_vpid(pid))) // task was found when code ran
{
found = 1;
}
if (found)
{
char* nothing = "NULL";
struct vm_area_struct *vma;
...
vma = task->mm->mmap;
while (vma != NULL)
{
...
if (!vma->vm_file->f_path.dentry->d_name.name)
{
printk("The file name mapped to this is %s\n", nothing);
}
...
}
...
return 0;
}
Why does this not work?
Aucun commentaire:
Enregistrer un commentaire