Skip to contentSkip to conversation

verbs: Use correct type for printf from struct rlimit

PATCH Applied Jason Gunthorpe 2 participants 2 messages Jan 30, 2018 – Jan 31, 2018 1 message not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 verbs: Use correct type for printf from struct rlimit

The actual type of the members is rlim_t which only happens to be unsigned long on the platforms we have tested so far. x32 uses something else.

Casting to unsigned long long for printing is the safe solution.

---
 libibverbs/init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
libibverbs/init.c +2 -2
index ff2c60ffcbc963..cda628b9e0544d 100644
@@ -552,9 +552,9 @@ static void check_memlock_limit(void)
 	}
 
 	if (rlim.rlim_cur <= 32768)
-		fprintf(stderr, PFX "Warning: RLIMIT_MEMLOCK is %lu bytes.\n"
+		fprintf(stderr, PFX "Warning: RLIMIT_MEMLOCK is %llu bytes.\n"
 			"    This will severely limit memory registrations.\n",
-			rlim.rlim_cur);
+			(unsigned long long)rlim.rlim_cur);
 }
 
 static int same_sysfs_dev(struct verbs_sysfs_dev *sysfs1,
Signature · 6 lines
2.15.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20180130224904.GA11309-uk2M96/[email protected]

#2 lore raw
Quoted 11 lines · Jason Gunthorpe

The actual type of the members is rlim_t which only happens to be unsigned long on the platforms we have tested so far. x32 uses something else.

Casting to unsigned long long for printing is the safe solution.

---
 libibverbs/init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Thanks, applied.