lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210926161259.238054-3-namit@vmware.com>
Date:   Sun, 26 Sep 2021 09:12:53 -0700
From:   Nadav Amit <nadav.amit@...il.com>
To:     Andrew Morton <akpm@...ux-foundation.org>
Cc:     linux-mm@...ck.org, linux-kernel@...r.kernel.org,
        Peter Xu <peterx@...hat.com>, Nadav Amit <namit@...are.com>,
        Andrea Arcangeli <aarcange@...hat.com>,
        Minchan Kim <minchan@...nel.org>,
        Colin Cross <ccross@...gle.com>,
        Suren Baghdasarya <surenb@...gle.com>,
        Mike Rapoport <rppt@...ux.vnet.ibm.com>
Subject: [RFC PATCH 2/8] mm/madvise: remove unnecessary check on madvise_dontneed_free()

From: Nadav Amit <namit@...are.com>

madvise_dontneed_free() is called only from madvise_vma() and the
behavior is always either MADV_FREE or MADV_DONTNEED. There is no need
to check again in madvise_dontneed_free() if the behavior is any
different.

Cc: Andrea Arcangeli <aarcange@...hat.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Minchan Kim <minchan@...nel.org>
Cc: Colin Cross <ccross@...gle.com>
Cc: Suren Baghdasarya <surenb@...gle.com>
Cc: Mike Rapoport <rppt@...ux.vnet.ibm.com>
Signed-off-by: Nadav Amit <namit@...are.com>
---
 mm/madvise.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/mm/madvise.c b/mm/madvise.c
index a2b05352ebfe..fe843513a4e8 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -820,10 +820,8 @@ static long madvise_dontneed_free(struct vm_area_struct *vma,
 
 	if (behavior == MADV_DONTNEED)
 		return madvise_dontneed_single_vma(vma, start, end);
-	else if (behavior == MADV_FREE)
+	else /* behavior == MADV_FREE */
 		return madvise_free_single_vma(vma, start, end);
-	else
-		return -EINVAL;
 }
 
 static long madvise_populate(struct vm_area_struct *vma,
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ