linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] devlink: Use DIV_ROUND_UP_ULL in DEVLINK_HEALTH_SIZE_TO_BUFFERS
@ 2019-01-22  4:23 Nathan Chancellor
  2019-01-23  5:00 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2019-01-22  4:23 UTC (permalink / raw)
  To: Jiri Pirko, David S. Miller
  Cc: Eran Ben Elisha, Moshe Shemesh, netdev, linux-kernel, Nathan Chancellor

When building this code on a 32-bit platform such as ARM, there is a
link time error (lld error shown, happpens with ld.bfd too):

ld.lld: error: undefined symbol: __aeabi_uldivmod
>>> referenced by devlink.c
>>>               net/core/devlink.o:(devlink_health_buffers_create) in archive built-in.a

This happens when using a regular division symbol with a u64 dividend.
Use DIV_ROUND_UP_ULL, which wraps do_div, to avoid this situation.

Fixes: cb5ccfbe73b3 ("devlink: Add health buffer support")
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
 net/core/devlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/devlink.c b/net/core/devlink.c
index 60248a53c0ad..9ee25dfbc09d 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -3599,7 +3599,7 @@ static int devlink_nl_cmd_region_read_dumpit(struct sk_buff *skb,
 
 #define DEVLINK_HEALTH_BUFFER_SIZE (4096 - GENL_HDRLEN)
 #define DEVLINK_HEALTH_BUFFER_DATA_SIZE (DEVLINK_HEALTH_BUFFER_SIZE / 2)
-#define DEVLINK_HEALTH_SIZE_TO_BUFFERS(size) DIV_ROUND_UP(size, DEVLINK_HEALTH_BUFFER_DATA_SIZE)
+#define DEVLINK_HEALTH_SIZE_TO_BUFFERS(size) DIV_ROUND_UP_ULL(size, DEVLINK_HEALTH_BUFFER_DATA_SIZE)
 #define DEVLINK_HEALTH_BUFFER_MAX_CHUNK 1024
 
 struct devlink_health_buffer {
-- 
2.20.1


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

* Re: [PATCH] devlink: Use DIV_ROUND_UP_ULL in DEVLINK_HEALTH_SIZE_TO_BUFFERS
  2019-01-22  4:23 [PATCH] devlink: Use DIV_ROUND_UP_ULL in DEVLINK_HEALTH_SIZE_TO_BUFFERS Nathan Chancellor
@ 2019-01-23  5:00 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-01-23  5:00 UTC (permalink / raw)
  To: natechancellor; +Cc: jiri, eranbe, moshe, netdev, linux-kernel

From: Nathan Chancellor <natechancellor@gmail.com>
Date: Mon, 21 Jan 2019 21:23:01 -0700

> When building this code on a 32-bit platform such as ARM, there is a
> link time error (lld error shown, happpens with ld.bfd too):
> 
> ld.lld: error: undefined symbol: __aeabi_uldivmod
>>>> referenced by devlink.c
>>>>               net/core/devlink.o:(devlink_health_buffers_create) in archive built-in.a
> 
> This happens when using a regular division symbol with a u64 dividend.
> Use DIV_ROUND_UP_ULL, which wraps do_div, to avoid this situation.
> 
> Fixes: cb5ccfbe73b3 ("devlink: Add health buffer support")
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>

Applied to net-next.

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

end of thread, other threads:[~2019-01-23  5:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-22  4:23 [PATCH] devlink: Use DIV_ROUND_UP_ULL in DEVLINK_HEALTH_SIZE_TO_BUFFERS Nathan Chancellor
2019-01-23  5:00 ` 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).