Module Name: src Committed By: maxv Date: Fri Sep 20 11:09:43 UTC 2019
Modified Files: src/sys/uvm: uvm_page.c uvm_physseg.c Log Message: Fix programming mistake: 'paddrp' is a pointer given as argument, setting it to NULL in the called function does not set it to NULL in the caller. Actually, the callers of these functions do not do anything with the special error handling, so drop the unused checks and the NULL assignments altogether. Found by the lgtm bot. To generate a diff of this commit: cvs rdiff -u -r1.199 -r1.200 src/sys/uvm/uvm_page.c cvs rdiff -u -r1.9 -r1.10 src/sys/uvm/uvm_physseg.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/uvm/uvm_page.c diff -u src/sys/uvm/uvm_page.c:1.199 src/sys/uvm/uvm_page.c:1.200 --- src/sys/uvm/uvm_page.c:1.199 Thu Mar 14 19:10:04 2019 +++ src/sys/uvm/uvm_page.c Fri Sep 20 11:09:43 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_page.c,v 1.199 2019/03/14 19:10:04 kre Exp $ */ +/* $NetBSD: uvm_page.c,v 1.200 2019/09/20 11:09:43 maxv Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -66,7 +66,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.199 2019/03/14 19:10:04 kre Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.200 2019/09/20 11:09:43 maxv Exp $"); #include "opt_ddb.h" #include "opt_uvm.h" @@ -629,10 +629,7 @@ uvm_page_physget_freelist(paddr_t *paddr panic("uvm_page_physget: called _after_ bootstrap"); /* Try to match at front or back on unused segment */ - if (uvm_page_physunload(lcv, freelist, paddrp) == false) { - if (paddrp == NULL) /* freelist fail, try next */ - continue; - } else + if (uvm_page_physunload(lcv, freelist, paddrp)) return true; } @@ -644,10 +641,7 @@ uvm_page_physget_freelist(paddr_t *paddr #endif { /* Try the front regardless. */ - if (uvm_page_physunload_force(lcv, freelist, paddrp) == false) { - if (paddrp == NULL) /* freelist fail, try next */ - continue; - } else + if (uvm_page_physunload_force(lcv, freelist, paddrp)) return true; } return false; Index: src/sys/uvm/uvm_physseg.c diff -u src/sys/uvm/uvm_physseg.c:1.9 src/sys/uvm/uvm_physseg.c:1.10 --- src/sys/uvm/uvm_physseg.c:1.9 Sun Jan 21 17:58:43 2018 +++ src/sys/uvm/uvm_physseg.c Fri Sep 20 11:09:43 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_physseg.c,v 1.9 2018/01/21 17:58:43 christos Exp $ */ +/* $NetBSD: uvm_physseg.c,v 1.10 2019/09/20 11:09:43 maxv Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -471,7 +471,6 @@ uvm_page_physunload(uvm_physseg_t upm, i seg = HANDLE_TO_PHYSSEG_NODE(upm); if (seg->free_list != freelist) { - paddrp = NULL; return false; } @@ -516,7 +515,6 @@ uvm_page_physunload_force(uvm_physseg_t panic("%s: unload attempted after uvm_page_init()\n", __func__); /* any room in this bank? */ if (seg->avail_start >= seg->avail_end) { - paddrp = NULL; return false; /* nope */ } @@ -662,7 +660,6 @@ uvm_page_physunload(uvm_physseg_t psi, i seg = VM_PHYSMEM_PTR(psi); if (seg->free_list != freelist) { - paddrp = NULL; return false; } @@ -717,7 +714,6 @@ uvm_page_physunload_force(uvm_physseg_t /* any room in this bank? */ if (seg->avail_start >= seg->avail_end) { - paddrp = NULL; return false; /* nope */ }