{
 #define        NUM_NOTES       6
        int has_dumped = 0;
-       mm_segment_t fs;
        int segs;
        int i;
        struct vm_area_struct *vma;
        /* alloc memory for large data structures: too large to be on stack */
        elf = kmalloc(sizeof(*elf), GFP_KERNEL);
        if (!elf)
-               goto cleanup;
+               goto end_coredump;
        prstatus = kzalloc(sizeof(*prstatus), GFP_KERNEL);
        if (!prstatus)
-               goto cleanup;
+               goto end_coredump;
        psinfo = kmalloc(sizeof(*psinfo), GFP_KERNEL);
        if (!psinfo)
-               goto cleanup;
+               goto end_coredump;
        notes = kmalloc_array(NUM_NOTES, sizeof(struct memelfnote),
                              GFP_KERNEL);
        if (!notes)
-               goto cleanup;
+               goto end_coredump;
        fpu = kmalloc(sizeof(*fpu), GFP_KERNEL);
        if (!fpu)
-               goto cleanup;
+               goto end_coredump;
 #ifdef ELF_CORE_COPY_XFPREGS
        xfpu = kmalloc(sizeof(*xfpu), GFP_KERNEL);
        if (!xfpu)
-               goto cleanup;
+               goto end_coredump;
 #endif
 
        for (ct = current->mm->core_state->dumper.next;
                                        ct; ct = ct->next) {
                tmp = kzalloc(sizeof(*tmp), GFP_KERNEL);
                if (!tmp)
-                       goto cleanup;
+                       goto end_coredump;
 
                tmp->thread = ct->task;
                list_add(&tmp->list, &thread_list);
                          "LINUX", ELF_CORE_XFPREG_TYPE, sizeof(*xfpu), xfpu);
 #endif
 
-       fs = get_fs();
-       set_fs(KERNEL_DS);
-
        offset += sizeof(*elf);                         /* Elf header */
        offset += segs * sizeof(struct elf_phdr);       /* Program headers */
 
        }
 
 end_coredump:
-       set_fs(fs);
-
-cleanup:
        while (!list_empty(&thread_list)) {
                struct list_head *tmp = thread_list.next;
                list_del(tmp);