netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] enic: Fix 64 bit divide on 32bit system
@ 2014-05-26 10:22 Govindarajulu Varadarajan
  2014-05-30 22:55 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Govindarajulu Varadarajan @ 2014-05-26 10:22 UTC (permalink / raw)
  To: netdev, davem
  Cc: arnd, David.Laight, gvaradar, Govindarajulu Varadarajan,
	Christian Benvenuti, Sujith Sankar, Neel Patel

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")
Reported-by: Jim Davis <jim.epost@gmail.com>
Cc: Christian Benvenuti <benve@cisco.com>
Cc: Sujith Sankar <ssujith@cisco.com>
Cc: Neel Patel <neepatel@cisco.com>
Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.com>
---
 drivers/net/ethernet/cisco/enic/enic_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
index 0d8995c..d5a220d 100644
--- a/drivers/net/ethernet/cisco/enic/enic_main.c
+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
@@ -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)
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] enic: Fix 64 bit divide on 32bit system
  2014-05-26 10:22 [PATCH net-next] enic: Fix 64 bit divide on 32bit system Govindarajulu Varadarajan
@ 2014-05-30 22:55 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-05-30 22:55 UTC (permalink / raw)
  To: _govind; +Cc: netdev, arnd, David.Laight, gvaradar, benve, ssujith, neepatel

From: Govindarajulu Varadarajan <_govind@gmx.com>
Date: Mon, 26 May 2014 15:52:43 +0530

> 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")
> Reported-by: Jim Davis <jim.epost@gmail.com>
> Cc: Christian Benvenuti <benve@cisco.com>
> Cc: Sujith Sankar <ssujith@cisco.com>
> Cc: Neel Patel <neepatel@cisco.com>
> Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.com>

Applied, thank you.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-05-30 22:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-26 10:22 [PATCH net-next] enic: Fix 64 bit divide on 32bit system Govindarajulu Varadarajan
2014-05-30 22:55 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).