Browse Source

Plan 9 from Bell Labs 2009-11-21

David du Colombier 10 years ago
parent
commit
fb55001296
2 changed files with 4 additions and 1 deletions
  1. 3 0
      sys/src/libdisk/disk.c
  2. 1 1
      sys/src/libmach/access.c

+ 3 - 0
sys/src/libdisk/disk.c

@@ -63,6 +63,9 @@ partitiongeometry(Disk *disk)
 	uchar buf[512];
 	Table *t;
 
+	if(disk->c == 0 || disk->h == 0 || disk->s == 0)
+		return -1;
+
 	t = (Table*)(buf + Toffset);
 
 	/*

+ 1 - 1
sys/src/libmach/access.c

@@ -209,7 +209,7 @@ mget(Map *map, uvlong addr, void *buf, int size)
 		return -1;
 	}
 	for (i = j = 0; i < 2; i++) {	/* in case read crosses page */
-		k = spread(s, buf, size-j, off+j);
+		k = spread(s, (void*)((uchar *)buf+j), size-j, off+j);
 		if (k < 0) {
 			werrstr("can't read address %llux: %r", addr);
 			return -1;