From 36e883967538069d81634bd2e6fa188732f0a77a Mon Sep 17 00:00:00 2001
From: Milan Broz <gmazyland@gmail.com>
Date: Thu, 11 Oct 2018 21:19:35 +0200
Subject: [PATCH 066/324] Do not fail if device is smaller than requested wipe
 size.

---
 lib/utils_wipe.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/utils_wipe.c b/lib/utils_wipe.c
index 04cc531..b1afc0f 100644
--- a/lib/utils_wipe.c
+++ b/lib/utils_wipe.c
@@ -164,6 +164,9 @@ int crypt_wipe_device(struct crypt_device *cd,
 	if (r || dev_size == 0)
 		goto out;
 
+	if (dev_size < length)
+		length = 0;
+
 	if (length) {
 		if ((dev_size <= offset) || (dev_size - offset) < length) {
 			r = -EINVAL;
-- 
2.19.1

