parser: always match the correct option length for posval options

Right now we match rw=randr as rw=randrw, since we use the length
of the passed in option. Use a correct max of the ival and string
passed in, so that we fail if a full match isn't present.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/parse.c b/parse.c
index 13783fa..18c4530 100644
--- a/parse.c
+++ b/parse.c
@@ -344,6 +344,11 @@
 	return (int)(postfix - str);
 }
 
+static int str_match_len(const struct value_pair *vp, const char *str)
+{
+	return max(strlen(vp->ival), opt_len(str));
+}
+
 #define val_store(ptr, val, off, or, data)		\
 	do {						\
 		ptr = td_var((data), (off));		\
@@ -388,7 +393,7 @@
 			if (!vp->ival || vp->ival[0] == '\0')
 				continue;
 			all_skipped = 0;
-			if (!strncmp(vp->ival, ptr, opt_len(ptr))) {
+			if (!strncmp(vp->ival, ptr, str_match_len(vp, ptr))) {
 				ret = 0;
 				if (o->roff1) {
 					if (vp->or)
@@ -549,7 +554,7 @@
 				if (!vp->ival || vp->ival[0] == '\0')
 					continue;
 				all_skipped = 0;
-				if (!strncmp(vp->ival, ptr, opt_len(ptr))) {
+				if (!strncmp(vp->ival, ptr, str_match_len(vp, ptr))) {
 					char *rest;
 
 					ret = 0;