Index: uspace/srv/bd/file_bd/file_bd.c
===================================================================
--- uspace/srv/bd/file_bd/file_bd.c	(revision 1ccafee9eb7706ba2c3ce30593949116d3e0cce2)
+++ uspace/srv/bd/file_bd/file_bd.c	(revision 5bda2f96b9329ae7404d5a7d97d205a166a1204d)
@@ -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);
 
