[syslinux:master] com32/chain: remove remains of SECTOR

syslinux-bot for Michal Soltys soltys at ziu.info
Mon Mar 26 15:03:26 PDT 2012


Commit-ID:  c6ef920182ecba8bd67ea88223be48685b2ca30d
Gitweb:     http://www.syslinux.org/commit/c6ef920182ecba8bd67ea88223be48685b2ca30d
Author:     Michal Soltys <soltys at ziu.info>
AuthorDate: Wed, 13 Oct 2010 23:32:38 +0200
Committer:  Michal Soltys <soltys at ziu.info>
CommitDate: Thu, 14 Oct 2010 23:08:29 +0200

com32/chain: remove remains of SECTOR

All chain related code no longer depends on hardcoded sector
size.

Signed-off-by: Michal Soltys <soltys at ziu.info>

---
 com32/chain/chain.c   |    8 ++++++--
 com32/chain/options.c |    4 ----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/com32/chain/chain.c b/com32/chain/chain.c
index 1236b38..3dc6d91 100644
--- a/com32/chain/chain.c
+++ b/com32/chain/chain.c
@@ -556,9 +556,13 @@ int main(int argc, char *argv[])
 
     /* Load the sector */
     if (opt.sect) {
-	sdat.size = SECTOR;
 	sdat.base = (opt.sseg << 4) + opt.soff;
+	sdat.size = iter->di.bps;
 
+	if (sdat.base + sdat.size - 1 > ADDRMAX) {
+	    error("The sector cannot be loaded at such high address.\n");
+	    goto bail;
+	}
 	if (opt.file && opt.maps && overlap(&fdat, &sdat)) {
 	    error("WARNING: The sector won't be loaded, as it would conflict with the boot file.\n");
 	    opt.sect = false;
@@ -568,7 +572,7 @@ int main(int argc, char *argv[])
 		goto bail;
 	    }
 	    if (opt.save) {
-		if (!(sbck = malloc(SECTOR))) {
+		if (!(sbck = malloc(sdat.size))) {
 		    error("Couldn't allocate cmp-buf for option 'save'.\n");
 		    goto bail;
 		}
diff --git a/com32/chain/options.c b/com32/chain/options.c
index 53810da..37b9f11 100644
--- a/com32/chain/options.c
+++ b/com32/chain/options.c
@@ -252,10 +252,6 @@ int parse_args(int argc, char *argv[])
 	    if (argv[i][4]) {
 		if (soi_s2n(argv[i] + 5, &opt.sseg, &opt.soff, &opt.sip, 0x7c00))
 		    goto bail;
-		if ((opt.sseg << 4) + opt.soff + SECTOR - 1 > ADDRMAX) {
-		    error("Arguments of 'sect=' are invalid - resulting address too big.\n");
-		    goto bail;
-		}
 	    }
 	    opt.sect = true;
 	} else if (!strcmp(argv[i], "nosect")) {


More information about the Syslinux-commits mailing list