Skip to contentSkip to conversation

LVM2/lib/device dev-md.c

PATCH [email protected] 1 participant 1 message Jul 20, 2009

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: snitzer at sourceware.org 2009-07-20 18:33:16

Modified files:
lib/device : dev-md.c

Log message:
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.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/dev-md.c.diff?cvsroot=lvm2&r1=1.14&r2=1.15

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