netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: arnd@arndb.de
Cc: peppe.cavallaro@st.com, alexandre.torgue@st.com,
	joabreu@synopsys.com, gustavo@embeddedor.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] stmmac: fix signed 64-bit division
Date: Sat, 07 Jul 2018 21:17:07 +0900 (KST)	[thread overview]
Message-ID: <20180707.211707.291855529179797010.davem@davemloft.net> (raw)
In-Reply-To: <20180706133646.312427-1-arnd@arndb.de>

From: Arnd Bergmann <arnd@arndb.de>
Date: Fri,  6 Jul 2018 15:36:07 +0200

> I link error on 32-bit ARM points to yet another arithmetic bug:
> 
> drivers/net/ethernet/stmicro/stmmac/stmmac_tc.o: In function `tc_setup_cbs':
> stmmac_tc.c:(.text+0x148): undefined reference to `__aeabi_uldivmod'
> stmmac_tc.c:(.text+0x1fc): undefined reference to `__aeabi_uldivmod'
> stmmac_tc.c:(.text+0x308): undefined reference to `__aeabi_uldivmod'
> stmmac_tc.c:(.text+0x320): undefined reference to `__aeabi_uldivmod'
> stmmac_tc.c:(.text+0x33c): undefined reference to `__aeabi_uldivmod'
> drivers/net/ethernet/stmicro/stmmac/stmmac_tc.o:stmmac_tc.c:(.text+0x3a4): more undefined references to `__aeabi_uldivmod' follow
> 
> I observe that the last change to add the 'ul' prefix was incorrect,
> as it did not turn the result of the multiplication into a 64-bit
> expression on 32-bit architectures. Further, it seems that the
> do_div() macro gets confused by the fact that we pass a signed
> variable rather than unsigned into it.
> 
> This changes the code to instead use the div_s64() helper that is
> meant for signed division, along with changing the constant suffix
> to 'll' to actually make it a 64-bit argument everywhere, fixing
> both of the issues I pointed out.
> 
> I'm not completely convinced that this makes the code correct, but
> I'm fairly sure that we have two problems less than before.
> 
> Fixes: 1f705bc61aee ("net: stmmac: Add support for CBS QDISC")
> Fixes: c18a9c096683 ("net: stmmac_tc: use 64-bit arithmetic instead of 32-bit")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Applied, thank you.

      parent reply	other threads:[~2018-07-07 12:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-06 13:36 [PATCH net-next] stmmac: fix signed 64-bit division Arnd Bergmann
2018-07-06 13:58 ` Gustavo A. R. Silva
2018-07-07 12:17 ` David Miller [this message]

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=20180707.211707.291855529179797010.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=alexandre.torgue@st.com \
    --cc=arnd@arndb.de \
    --cc=gustavo@embeddedor.com \
    --cc=joabreu@synopsys.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=peppe.cavallaro@st.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).