From: Karel Zak Date: Thu, 23 May 2019 10:31:49 +0000 (+0200) Subject: lsblk: check ul_path_scanf() return value [coverity scan] X-Git-Tag: v2.34-rc2~31 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=74152bf944837cb095c46fb4d3757086a0b94f64;p=thirdparty%2Futil-linux.git lsblk: check ul_path_scanf() return value [coverity scan] Signed-off-by: Karel Zak --- diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c index 2ad2a43392..3f8a1160f2 100644 --- a/misc-utils/lsblk.c +++ b/misc-utils/lsblk.c @@ -676,12 +676,13 @@ static int is_removable_device(struct lsblk_device *dev, struct lsblk_device *pa if (!pc) goto done; + /* dev is partition and parent is whole-disk */ if (pc == parent->sysfs) - /* dev is partition and parent is whole-disk */ dev->removable = is_removable_device(parent, NULL); - else - /* parent is something else, use sysfs parent */ - ul_path_scanf(pc, "removable", "%d", &dev->removable); + + /* parent is something else, use sysfs parent */ + else if (ul_path_scanf(pc, "removable", "%d", &dev->removable) != 1) + dev->removable = 0; } done: if (dev->removable == -1)