Fix overlap check in autoalloc code; ending_sector is the sector after the
authorkettenis <kettenis@openbsd.org>
Sun, 30 May 2021 19:02:30 +0000 (19:02 +0000)
committerkettenis <kettenis@openbsd.org>
Sun, 30 May 2021 19:02:30 +0000 (19:02 +0000)
OpenBSD area of the disk so it is fine if a "foreign" partition starts at
ending_sector.

ok krw@, otto@

sbin/disklabel/editor.c

index 86424f8..8708f3d 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: editor.c,v 1.367 2021/03/09 07:03:19 deraadt Exp $    */
+/*     $OpenBSD: editor.c,v 1.368 2021/05/30 19:02:30 kettenis Exp $   */
 
 /*
  * Copyright (c) 1997-2000 Todd C. Miller <millert@openbsd.org>
@@ -571,8 +571,8 @@ editor_allocspace(struct disklabel *lp_org)
                pstart = DL_GETPOFFSET(pp);
                pend = pstart + psz;
                if (i != RAW_PART && psz != 0 &&
-                   ((pstart >= starting_sector && pstart <= ending_sector) ||
-                   (pend > starting_sector && pend < ending_sector))) {
+                   ((pstart >= starting_sector && pstart < ending_sector) ||
+                   (pend > starting_sector && pend <= ending_sector))) {
                        overlap = 1;
                        break;
                }