Skip to contentSkip to conversation

enic: Fix 64 bit divide on 32bit system

PATCH Applied Govindarajulu Varadarajan 2 participants 2 messages May 26, 2014 – May 30, 2014

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

PATCH 1/1 enic: Fix 64 bit divide on 32bit system

Division of a 32 bit number by a 64 bit number causes the following link error introduced by
7c2ce6e60f703 "enic: Add support for adaptive interrupt coalescing"

drivers/built-in.o: In function `enic_poll_msix':
enic_main.c:(.text+0x48710a): undefined reference to `__udivdi3'
make: *** [vmlinux] Error 1

Since numerator is 32 bit, convert denominator to 32 bit accordingly.

Fixes 7c2ce6e60f703 ("enic: Add support for adaptive interrupt coalescing")
Cc Christian Benvenuti <[email protected]>
Cc Sujith Sankar <[email protected]>
Cc Neel Patel <[email protected]>
---
 drivers/net/ethernet/cisco/enic/enic_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/cisco/enic/enic_main.c +1 -1
index 0d8995c..d5a220d 100644
@@ -1217,7 +1217,7 @@ static void enic_calc_int_moderation(struct enic *enic, struct vnic_rq *rq)
 	 */
 
 	traffic <<= 3;
-	traffic /= delta;
+	traffic = delta > UINT_MAX ? 0 : traffic / (u32)delta;
 
 	for (index = 0; index < ENIC_MAX_COALESCE_TIMERS; index++)
 		if (traffic < mod_table[index].rx_rate)
Signature · 1 line
1.9.2
maintainer Applied
#1 lore raw

From: Govindarajulu Varadarajan <[email protected]>
Date: Mon, 26 May 2014 15:52:43 +0530

Quoted 8 lines

Division of a 32 bit number by a 64 bit number causes the following link error introduced by
7c2ce6e60f703 "enic: Add support for adaptive interrupt coalescing"

drivers/built-in.o: In function `enic_poll_msix':
enic_main.c:(.text+0x48710a): undefined reference to `__udivdi3'
make: *** [vmlinux] Error 1

Quoted 8 lines

Since numerator is 32 bit, convert denominator to 32 bit accordingly.

Fixes 7c2ce6e60f703 ("enic: Add support for adaptive interrupt coalescing")
Cc Christian Benvenuti <[email protected]>
Cc Sujith Sankar <[email protected]>
Cc Neel Patel <[email protected]>

Applied, thank you.