Index: uspace/srv/bd/file_bd/file_bd.c
===================================================================
--- uspace/srv/bd/file_bd/file_bd.c	(revision e27cf669cb84d831da5b56f6fc99cd623239ba41)
+++ uspace/srv/bd/file_bd/file_bd.c	(revision fb150d78322de0f69c6ab8b6215275ef5c0db14a)
@@ -48,4 +48,5 @@
 #include <devmap.h>
 #include <sys/types.h>
+#include <sys/typefmt.h>
 #include <errno.h>
 #include <bool.h>
@@ -207,4 +208,12 @@
 	int rc;
 
+	/* Check whether access is within device address bounds. */
+	if (ba + cnt > num_blocks) {
+		printf(NAME ": Accessed blocks %" PRIuBN "-%" PRIuBN ", while "
+		    "max block number is %" PRIuBN ".\n", ba, ba + cnt - 1,
+		    num_blocks - 1);
+		return ELIMIT;
+	}
+
 	fibril_mutex_lock(&dev_lock);
 
@@ -237,4 +246,12 @@
 	int rc;
 
+	/* Check whether access is within device address bounds. */
+	if (ba + cnt > num_blocks) {
+		printf(NAME ": Accessed blocks %" PRIuBN "-%" PRIuBN ", while "
+		    "max block numeber is %" PRIuBN ".\n", ba, ba + cnt - 1,
+		    num_blocks - 1);
+		return ELIMIT;
+	}
+
 	fibril_mutex_lock(&dev_lock);
 
