1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Cast MAJOR() and MINOR() to int when used with "%d" in dm_snprintf() call.

Fixes SEGV in _md_sysfs_attribute_snprintf() on 32-bit systems.
This commit is contained in:
Mike Snitzer 2009-07-20 18:33:16 +00:00
parent 2206eb2409
commit 6111e048a3

View File

@ -139,8 +139,8 @@ static int _md_sysfs_attribute_snprintf(char *path, size_t size,
if (!sysfs_dir || !*sysfs_dir) if (!sysfs_dir || !*sysfs_dir)
return ret; return ret;
ret = dm_snprintf(path, size, "%s/dev/block/%d:%d/md/%s", ret = dm_snprintf(path, size, "%s/dev/block/%d:%d/md/%s", sysfs_dir,
sysfs_dir, MAJOR(dev->dev), MINOR(dev->dev), attribute); (int)MAJOR(dev->dev), (int)MINOR(dev->dev), attribute);
if (ret < 0) { if (ret < 0) {
log_error("dm_snprintf md %s failed", attribute); log_error("dm_snprintf md %s failed", attribute);
return ret; return ret;