fix: Use 'kernel_read' to read from procfs
[lttng-modules.git] / wrapper / random.c
index eb41769c650f54d1ddb569f207a1bc45e0765292..d7e53cd140f0a7517fb6ce66b1c492e9959882c8 100644 (file)
@@ -28,21 +28,12 @@ int wrapper_get_bootid(char *bootid)
        struct file *file;
        int ret;
        ssize_t len;
-       mm_segment_t old_fs;
 
        file = filp_open("/proc/sys/kernel/random/boot_id", O_RDONLY, 0);
        if (IS_ERR(file))
                return PTR_ERR(file);
 
-       old_fs = get_fs();
-       set_fs(KERNEL_DS);
-
-       if (!file->f_op || !file->f_op->read) {
-               ret = -EINVAL;
-               goto end;
-       }
-
-       len = file->f_op->read(file, bootid, BOOT_ID_LEN - 1, &file->f_pos);
+       len = kernel_read(file, bootid, BOOT_ID_LEN - 1, &file->f_pos);
        if (len != BOOT_ID_LEN - 1) {
                ret = -EINVAL;
                goto end;
@@ -51,7 +42,6 @@ int wrapper_get_bootid(char *bootid)
        bootid[BOOT_ID_LEN - 1] = '\0';
        ret = 0;
 end:
-       set_fs(old_fs);
        filp_close(file, current->files);
        return ret;
 }
This page took 0.02645 seconds and 4 git commands to generate.