shithub: riscv

Download patch

ref: 29c7ca80c9df8f805217be9bb9a9a083ff12912d
parent: b15430979d712d27ea4cd40ca2ab031206081dfe
author: cinap_lenrek <[email protected]>
date: Mon May 16 17:10:08 EDT 2016

correct check for segment overlap (rmiller)

--- a/sys/src/9/port/segment.c
+++ b/sys/src/9/port/segment.c
@@ -427,7 +427,7 @@
 		ns = up->seg[i];
 		if(ns == nil || ns == s)
 			continue;
-		if(newtop >= ns->base && newtop < ns->top) {
+		if(newtop > ns->base && s->base < ns->top) {
 			qunlock(s);
 			error(Esoverlap);
 		}
@@ -544,8 +544,7 @@
 		ns = up->seg[i];
 		if(ns == nil)
 			continue;
-		if((newtop > ns->base && newtop <= ns->top) ||
-		   (va >= ns->base && va < ns->top))
+		if(newtop > ns->base && va < ns->top)
 			return ns;
 	}
 	return nil;