netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Govindarajulu Varadarajan <_govind@gmx.com>
To: netdev@vger.kernel.org, davem@davemloft.net
Cc: arnd@arndb.de, David.Laight@aculab.com, gvaradar@cisco.com,
	Govindarajulu Varadarajan <_govind@gmx.com>,
	Christian Benvenuti <benve@cisco.com>,
	Sujith Sankar <ssujith@cisco.com>,
	Neel Patel <neepatel@cisco.com>
Subject: [PATCH net-next] enic: Fix 64 bit divide on 32bit system
Date: Mon, 26 May 2014 15:52:43 +0530	[thread overview]
Message-ID: <1401099763-2427-1-git-send-email-_govind@gmx.com> (raw)

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

             reply	other threads:[~2014-05-26 10:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-26 10:22 Govindarajulu Varadarajan [this message]
2014-05-30 22:55 ` [PATCH net-next] enic: Fix 64 bit divide on 32bit system David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1401099763-2427-1-git-send-email-_govind@gmx.com \
    --to=_govind@gmx.com \
    --cc=David.Laight@aculab.com \
    --cc=arnd@arndb.de \
    --cc=benve@cisco.com \
    --cc=davem@davemloft.net \
    --cc=gvaradar@cisco.com \
    --cc=neepatel@cisco.com \
    --cc=netdev@vger.kernel.org \
    --cc=ssujith@cisco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).