don't allow subtraction to fool us. Reference: /n/atom/patch/applied2013/kseg2care Date: Tue Sep 17 03:20:19 CES 2013 Signed-off-by: quanstro@quanstro.net --- /sys/src/nix/k10/mmu.c Tue Sep 17 03:20:02 2013 +++ /sys/src/nix/k10/mmu.c Tue Sep 17 03:20:04 2013 @@ -575,6 +575,8 @@ int use, flags; uintmem pa, sz; + if(va < KSEG2 || va > KSEG2END) + return -1; pa = va - KSEG2; if((pa = adrmemtype(pa, &sz, &flags, &use)) == 0 || use != Mvmap) return -1; --- /sys/src/nix/k10/mem.h Tue Sep 17 03:20:06 2013 +++ /sys/src/nix/k10/mem.h Tue Sep 17 03:20:07 2013 @@ -67,7 +67,7 @@ * Address spaces. Kernel, sorted by address. */ #define KSEG2 (0xfffffe0000000000ull) /* 1TB - KMAP */ -/* 0xffffff0000000000ull end of KSEG2 */ +#define KSEG2END 0xffffff0000000000ull /* end of KSEG2 */ #define KSEG0 (0xfffffffff0000000ull) /* 256MB - this is confused */ #define KZERO (0xfffffffff0000000ull) #define KTZERO (KZERO+1*MiB+64*KiB)