]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
fs/proc/vmcore.c: simpler /proc/vmcore cleanup
authorAlexey Dobriyan <adobriyan@gmail.com>
Tue, 6 Feb 2018 23:37:02 +0000 (15:37 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 7 Feb 2018 02:32:43 +0000 (18:32 -0800)
Iterators aren't necessary as you can just grab the first entry and delete
it until no entries left.

Link: http://lkml.kernel.org/r/20171121191121.GA20757@avx2
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/proc/vmcore.c

index 885d445afa0d9b27aea63002413d78bee3bc77e7..a45f0af22a60ec20d0bd354a8b0684f2d3296a51 100644 (file)
@@ -1178,18 +1178,16 @@ fs_initcall(vmcore_init);
 /* Cleanup function for vmcore module. */
 void vmcore_cleanup(void)
 {
-       struct list_head *pos, *next;
-
        if (proc_vmcore) {
                proc_remove(proc_vmcore);
                proc_vmcore = NULL;
        }
 
        /* clear the vmcore list. */
-       list_for_each_safe(pos, next, &vmcore_list) {
+       while (!list_empty(&vmcore_list)) {
                struct vmcore *m;
 
-               m = list_entry(pos, struct vmcore, list);
+               m = list_first_entry(&vmcore_list, struct vmcore, list);
                list_del(&m->list);
                kfree(m);
        }