Thread (10 messages) 10 messages, 4 authors, 2017-08-23
STALE3237d

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

From: Eric Sandeen <hidden>
Date: 2017-08-22 21:12:49
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---
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);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help