On Tue, 2020-09-15 at 12:41 +0800, lixiaokeng wrote: > We check return value of udev_device_get_devtype before > dereference it. > > Signed-off-by:Lixiaokeng<lixiaokeng@xxxxxxxxxx> > Signed-off-by: Zhiqiang Liu <liuzhiqiang26@xxxxxxxxxx> > Signed-off-by: Linfeilong <linfeilong@xxxxxxxxxx> > --- > libmultipath/foreign/nvme.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/libmultipath/foreign/nvme.c > b/libmultipath/foreign/nvme.c > index 0bc5106e..a0668713 100644 > --- a/libmultipath/foreign/nvme.c > +++ b/libmultipath/foreign/nvme.c > @@ -538,6 +538,7 @@ struct udev_device *get_ctrl_blkdev(const struct > context *ctx, > struct udev_list_entry *item; > struct udev_device *blkdev = NULL; > struct udev_enumerate *enm = udev_enumerate_new(ctx->udev); > + const char *devtype; > > if (enm == NULL) > return NULL; > @@ -562,7 +563,9 @@ struct udev_device *get_ctrl_blkdev(const struct > context *ctx, > udev_list_entry_get_name(ite > m)); > if (tmp == NULL) > continue; > - if (!strcmp(udev_device_get_devtype(tmp), "disk")) { > + > + devtype = udev_device_get_devtype(tmp); > + if (!devtype && !strcmp(devtype, "disk")) { > blkdev = tmp; > break; > } else This looks wrong. -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel