um: ubd: fix command line handling of ubd

This commit fixes a regression to handle command line parameters of ubd.
With a simple line "./linux ubd0="./disk-ext4.img", it fails at
ubd_setup_common().  The commit adds additional checks to the variables
in order to properly parse the paremeters which previously worked.

Fixes: ef3ba87cb7 ("um: ubd: Set device serial attribute from cmdline")
Cc: Christopher Obbard <chris.obbard@collabora.com>
Signed-off-by: Hajime Tazaki <thehajime@gmail.com>
Acked-by: Christopher Obbard <chris.obbard@collabora.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
This commit is contained in:
Hajime Tazaki 2020-12-21 11:24:34 +09:00 committed by Richard Weinberger
parent 4992eb41ab
commit 94c41b3a7c

View File

@ -375,11 +375,11 @@ break_loop:
file = NULL;
backing_file = strsep(&str, ",:");
if (*backing_file == '\0')
if (backing_file && *backing_file == '\0')
backing_file = NULL;
serial = strsep(&str, ",:");
if (*serial == '\0')
if (serial && *serial == '\0')
serial = NULL;
if (backing_file && ubd_dev->no_cow) {