У меня системный вызов для ядра Linux. При проверке на null в операторе if процесс завершается:
unable to handle kernel null pointer reference at [position]
Неисправный код ниже:
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;
}
Почему это не работает?