Whamcloud - gitweb
LU-12198 libcfs: always copy ioctl header back to user
[fs/lustre-release.git] / libcfs / libcfs / module.c
index d925a6c..bb6abb6 100644 (file)
@@ -224,9 +224,8 @@ static int libcfs_ioctl(unsigned long cmd, void __user *uparam)
                        err = -EINVAL;
                else
                        err = notifier_to_errno(err);
-               if (!err)
-                       if (copy_to_user(uparam, hdr, hdr->ioc_len))
-                               err = -EFAULT;
+               if (copy_to_user(uparam, hdr, hdr->ioc_len) && !err)
+                       err = -EFAULT;
                break;
        }
 out: