Skip to contentSkip to conversation

mm-mprotectc-avoid-repeated-assignment-in-do_mprotect_pkey.patch removed from -mm tree

merged [email protected] 1 participant 1 message Nov 11, 2021

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: mm/mprotect.c: avoid repeated assignment in do_mprotect_pkey()
has been removed from the -mm tree. Its filename was
mm-mprotectc-avoid-repeated-assignment-in-do_mprotect_pkey.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Liu Song <[email protected]>
Subject: mm/mprotect.c: avoid repeated assignment in do_mprotect_pkey()

After adjustment, the repeated assignment of "prev" is avoided, and the readability of the code is improved.

---

 mm/mprotect.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
mm/mprotect.c renamed from mm/mprotect.c~mm-mprotectc-avoid-repeated-assignment-in-do_mprotect_pkey +4 -1
@@ -563,7 +563,7 @@ static int do_mprotect_pkey(unsigned lon
 	error = -ENOMEM;
 	if (!vma)
 		goto out;
-	prev = vma->vm_prev;
+
 	if (unlikely(grows & PROT_GROWSDOWN)) {
 		if (vma->vm_start >= end)
 			goto out;
@@ -581,8 +581,11 @@ static int do_mprotect_pkey(unsigned lon
 				goto out;
 		}
 	}
+
 	if (start > vma->vm_start)
 		prev = vma;
+	else
+		prev = vma->vm_prev;
 
 	for (nstart = start ; ; ) {
 		unsigned long mask_off_old_flags;

_

Patches currently in -mm which might be from [email protected] are