Index: uspace/app/hdisk/func_gpt.c
===================================================================
--- uspace/app/hdisk/func_gpt.c	(revision e3bc35535127f70c39dbb0db723a7da15287e0aa)
+++ uspace/app/hdisk/func_gpt.c	(revision 2b55edb3c9ee72f1dbe4878d2663fac0493c75a9)
@@ -184,5 +184,5 @@
 		sa = gpt_get_next_aligned(sa, alignment);
 	
-	printf("Set end addres (number): ");
+	printf("Set end address (number): ");
 	ea = get_input_uint64(in);
 	
Index: uspace/lib/gpt/libgpt.c
===================================================================
--- uspace/lib/gpt/libgpt.c	(revision e3bc35535127f70c39dbb0db723a7da15287e0aa)
+++ uspace/lib/gpt/libgpt.c	(revision 2b55edb3c9ee72f1dbe4878d2663fac0493c75a9)
@@ -58,4 +58,5 @@
 static uint8_t get_byte(const char *);
 static bool check_overlap(gpt_part_t *, gpt_part_t *);
+static bool check_encaps(gpt_part_t *, uint64_t, uint64_t);
 
 /** Allocate memory for gpt label */
@@ -308,13 +309,7 @@
 			goto fini_fail;
 	}
-
-	/*
-	 * FIXME: so far my boasting about variable partition entry size
-	 * will not work. The CRC32 checksums will be different.
-	 * This can't be fixed easily - we'd have to run the checksum
-	 * on all of the partition entry array.
-	 */
+	
 	uint32_t crc = compute_crc32((uint8_t *) label->parts->part_array, 
-	                   fillries * sizeof(gpt_entry_t));
+	                   fillries * ent_size);
 
 	if(uint32_t_le2host(label->gpt->header->pe_array_crc32) != crc)
@@ -350,8 +345,6 @@
 	size_t fillries = label->parts->fill > GPT_MIN_PART_NUM ? label->parts->fill : GPT_MIN_PART_NUM;
 	
-	label->gpt->header->fillries = host2uint32_t_le(fillries);
-	label->gpt->header->pe_array_crc32 = host2uint32_t_le(compute_crc32(
-	                               (uint8_t *) label->parts->part_array,
-	                               fillries * e_size));
+	if (e_size != sizeof(gpt_entry_t))
+		return ENOTSUP;
 	
 	/* comm_size of 4096 is ignored */
@@ -369,7 +362,36 @@
 		goto fail;
 	
+	label->gpt->header->fillries = host2uint32_t_le(fillries);
 	uint64_t arr_blocks = (fillries * sizeof(gpt_entry_t)) / b_size;
 	label->gpt->header->first_usable_lba = host2uint64_t_le(arr_blocks + 1);
-	label->gpt->header->last_usable_lba = host2uint64_t_le(n_blocks - arr_blocks - 2);
+	uint64_t first_lba = n_blocks - arr_blocks - 2;
+	label->gpt->header->last_usable_lba = host2uint64_t_le(first_lba);
+	
+	/* Perform checks */
+	gpt_part_foreach(label, p) {
+		if (gpt_get_part_type(p) == GPT_PTE_UNUSED)
+			continue;
+		
+		if (!check_encaps(p, n_blocks, first_lba)) {
+			rc = ERANGE;
+			goto fail;
+		}
+		
+		gpt_part_foreach(label, q) {
+			if (p == q)
+				continue;
+			
+			if (gpt_get_part_type(p) != GPT_PTE_UNUSED) {
+				if (check_overlap(p, q)) {
+					rc = ERANGE;
+					goto fail;
+				}
+			}
+		}
+	}
+	
+	label->gpt->header->pe_array_crc32 = host2uint32_t_le(compute_crc32(
+	                               (uint8_t *) label->parts->part_array,
+	                               fillries * e_size));
 	
 	
@@ -483,12 +505,4 @@
 int gpt_add_partition(gpt_label_t *label, gpt_part_t *partition)
 {
-	/* FIXME: Check dimensions! */
-	gpt_part_foreach(label, p) {
-		if (gpt_get_part_type(p) != GPT_PTE_UNUSED) {
-			if (check_overlap(partition, p))
-				return EINVAL;
-		}
-	}
-	
 	gpt_part_t *p;
 	/* Find the first empty entry */
@@ -833,3 +847,12 @@
 }
 
-
+static bool check_encaps(gpt_part_t *p, uint64_t n_blocks, uint64_t first_lba)
+{
+	uint64_t start = uint64_t_le2host(p->start_lba);
+	uint64_t end = uint64_t_le2host(p->end_lba);
+	
+	if (start >= first_lba && end < n_blocks - first_lba)
+		return true;
+	
+	return false;
+}
