[PATCH 1/3] libxfs: handle 0 blocksize or sectorsize in cvtnum

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Blocksize and sectorsize are unique in that they must
be provided, unlike every other suffix which can be
calculated from constants.

Nothing protects against unspecified block & sector size,
so catch it if it happens and return a parsing error.

Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
---

diff --git a/libxcmd/input.c b/libxcmd/input.c
index 7a69dc1..7b86225 100644
--- a/libxcmd/input.c
+++ b/libxcmd/input.c
@@ -330,8 +330,12 @@ cvtnum(
 	c = tolower(*sp);
 	switch (c) {
 	case 'b':
+		if (!blocksize)
+			return -1LL;
 		return i * blocksize;
 	case 's':
+		if (!sectorsize)
+			return -1LL;
 		return i * sectorsize;
 	case 'k':
 		return KILOBYTES(i);
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux