diff --git a/fsp/fsp0fsp.c b/fsp/fsp0fsp.c
index 78fb55e4ef3ac77df8fc4dc353d631a423fa4171..e1074933fe8967d351e65c7b5a4decb563b4c48c 100644
--- a/fsp/fsp0fsp.c
+++ b/fsp/fsp0fsp.c
@@ -2829,7 +2829,7 @@ will be able to insert new data to the database without running out the
 tablespace. Only free extents are taken into account and we also subtract
 the safety margin required by the above function fsp_reserve_free_extents. */
 
-ulint
+ullint
 fsp_get_available_space_in_free_extents(
 /*====================================*/
 			/* out: available space in kB */
@@ -2895,7 +2895,8 @@ fsp_get_available_space_in_free_extents(
 		return(0);
 	}
 
-	return(((n_free - reserve) * FSP_EXTENT_SIZE)
+	return((ullint)(n_free - reserve)
+	       * FSP_EXTENT_SIZE
 	       * (UNIV_PAGE_SIZE / 1024));
 }
 
diff --git a/handler/ha_innodb.cc b/handler/ha_innodb.cc
index 694287cd70c090cdf72f63c3d3b4be2c69b8fa60..d67cf0192e10a8ea5a2e7b22506f06119a342cc4 100644
--- a/handler/ha_innodb.cc
+++ b/handler/ha_innodb.cc
@@ -5847,9 +5847,9 @@ ha_innobase::update_table_comment(
 	mutex_enter_noninline(&srv_dict_tmpfile_mutex);
 	rewind(srv_dict_tmpfile);
 
-	fprintf(srv_dict_tmpfile, "InnoDB free: %lu kB",
-		   (ulong) fsp_get_available_space_in_free_extents(
-					prebuilt->table->space));
+	fprintf(srv_dict_tmpfile, "InnoDB free: %llu kB",
+		fsp_get_available_space_in_free_extents(
+			prebuilt->table->space));
 
 	dict_print_info_on_foreign_keys(FALSE, srv_dict_tmpfile,
 				prebuilt->trx, prebuilt->table);
diff --git a/include/fsp0fsp.h b/include/fsp0fsp.h
index d04269fc157cef2f713cbd447330cc68d8168cf5..82e95a2e920bb0b7cfbac7603858af7602e10ade 100644
--- a/include/fsp0fsp.h
+++ b/include/fsp0fsp.h
@@ -245,7 +245,7 @@ will be able to insert new data to the database without running out the
 tablespace. Only free extents are taken into account and we also subtract
 the safety margin required by the above function fsp_reserve_free_extents. */
 
-ulint
+ullint
 fsp_get_available_space_in_free_extents(
 /*====================================*/
 			/* out: available space in kB */
diff --git a/include/univ.i b/include/univ.i
index 39865c10e5ea87d6f23e8103fcde4a6852426159..ba8e6e562194a15e3f40635edc5cfc656853361a 100644
--- a/include/univ.i
+++ b/include/univ.i
@@ -216,6 +216,8 @@ typedef __int64			ib_longlong;
 typedef longlong		ib_longlong;
 #endif
 
+typedef unsigned long long int	ullint;
+
 #ifndef __WIN__
 #if SIZEOF_LONG != SIZEOF_VOIDP
 #error "Error: InnoDB's ulint must be of the same size as void*"