Fix parser bug
If the option parser sees a ':', it automatically assumes that
you meant a range. It will then try to parse the second half of the
option. This isn't just my external: option, it happens to mem: as
well. That is:
1) Option mem=mmaphuge:/dev/shm/foo
2) handle_option() notices the ':' and stores off ptr2.
3) __handle_option() corectly sees the option "mem" and maps
"mmaphuge" to MEM_MMAPHUGE. It then calls str_mem_cb(), which
stores off the "/dev/shm/foo" after the ':'. Still working
great.
4) Control returns to handle_option(), which sees that ptr2 is
non-NULL. It calls __handle_option() again, pointing to the
string after the ':'.
5) __handle_option() prints an error, as "/dev/shm/foo" is not a
known option.
Fix it by breaking out early for the 2nd parse round if the option
type is a string.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
1 file changed