Skip to contentSkip to conversation

devlink: Use DIV_ROUND_UP_ULL in DEVLINK_HEALTH_SIZE_TO_BUFFERS

PATCH Applied Nathan Chancellor 2 participants 2 messages Jan 22, 2019 – Jan 23, 2019

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

PATCH 1/1 devlink: Use DIV_ROUND_UP_ULL in DEVLINK_HEALTH_SIZE_TO_BUFFERS

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

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

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")
---
 net/core/devlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/devlink.c +1 -1
index 60248a53c0ad..9ee25dfbc09d 100644
@@ -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 {
Signature · 1 line
2.20.1
maintainer Applied
#1 lore raw

From: Nathan Chancellor <[email protected]>
Date: Mon, 21 Jan 2019 21:23:01 -0700

Quoted 4 lines

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

Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

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")

Applied to net-next.