device nodes with 0 dev_t are not real (and for that reason such inodes
are used as whiteouts in overlayfs, for example), hence refuse them
early. It seems wrong going to sysfs for something we know can't exist
anyway.
assert_return(ret, -EINVAL);
assert_return(IN_SET(type, 'b', 'c'), -EINVAL);
+ if (devnum == 0)
+ return log_debug_errno(SYNTHETIC_ERRNO(ENODEV),
+ "sd-device: Attempted to allocate device by zero major/minor, refusing.");
+
/* use /sys/dev/{block,char}/<maj>:<min> link */
xsprintf(id, "%u:%u", major(devnum), minor(devnum));