Skip to contentSkip to conversation

megaraid_sas: fix a bug for 64 bit arches

PATCH In review Dan Carpenter 2 participants 2 messages Jun 28, 2013 – Jul 2, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 megaraid_sas: fix a bug for 64 bit arches

On 64 bit then -1UL and -1U are not equal, so these conditions don't work as intended and it breaks error handling.

drivers/scsi/megaraid/megaraid_sas_fp.c +2 -2
index 8056eac..4f401f7 100644
@@ -585,7 +585,7 @@ u8 get_arm(struct megasas_instance *instance, u32 ld, u8 span, u64 stripe,
 	case 1:
 		/* start with logical arm */
 		arm = get_arm_from_strip(instance, ld, stripe, map);
-		if (arm != -1UL)
+		if (arm != -1U)
 			arm *= 2;
 		break;
 	}
@@ -637,7 +637,7 @@ static u8 mr_spanset_get_phy_params(struct megasas_instance *instance, u32 ld,
 
 	if (raid->level = 6) {
 		logArm = get_arm_from_strip(instance, ld, stripRow, map);
-		if (logArm = -1UL)
+		if (logArm = -1U)
 			return FALSE;
 		rowMod = mega_mod64(row, SPAN_ROW_SIZE(map, ld, span));
 		armQ = SPAN_ROW_SIZE(map, ld, span) - 1 - rowMod;
Acked-by on v1 1/1
#1 lore raw
Quoted 37 lines

-----Original Message-----
From: Dan Carpenter [mailto:[email protected]]
Sent: Saturday, June 29, 2013 2:51 AM
To: DL-MegaRAID Linux; Saxena, Sumit
Cc: James E.J. Bottomley; [email protected]; kernel- [email protected]
Subject: [patch] [SCSI] megaraid_sas: fix a bug for 64 bit arches

On 64 bit then -1UL and -1U are not equal, so these conditions don't work as intended and it breaks error handling.

drivers/scsi/megaraid/megaraid_sas_fp.c +1 -1
index 8056eac..4f401f7 100644
@@ -585,7 +585,7 @@ u8 get_arm(struct megasas_instance *instance, u32
 ld, u8 span, u64 stripe,
 	case 1:
 		/* start with logical arm */
 		arm = get_arm_from_strip(instance, ld, stripe, map);
-		if (arm != -1UL)
+		if (arm != -1U)
 			arm *= 2;
 		break;
	}
drivers/scsi/megaraid/megaraid_sas_fp.c +1 -1
@@ -637,7 +637,7 @@ static u8 mr_spanset_get_phy_params(struct
 megasas_instance *instance, u32 ld,
 
 	if (raid->level == 6) {
 		logArm = get_arm_from_strip(instance, ld, stripRow, map);
-		if (logArm == -1UL)
+		if (logArm == -1U)
 			return FALSE;
 		rowMod = mega_mod64(row, SPAN_ROW_SIZE(map, ld, span));
Quoted 1 line
		armQ = SPAN_ROW_SIZE(map, ld, span) - 1 - rowMod;

Sumit