diff mbox

verbs: Use correct type for printf from struct rlimit

Message ID 20180130224904.GA11309@ziepe.ca (mailing list archive)
State Accepted
Headers show

Commit Message

Jason Gunthorpe Jan. 30, 2018, 10:49 p.m. UTC
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.

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
---
 libibverbs/init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Leon Romanovsky Jan. 31, 2018, 5:58 a.m. UTC | #1
On Tue, Jan 30, 2018 at 03:49:04PM -0700, Jason Gunthorpe wrote:
> 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.
>
> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
> ---
>  libibverbs/init.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>

Thanks, applied.
diff mbox

Patch

diff --git a/libibverbs/init.c b/libibverbs/init.c
index ff2c60ffcbc963..cda628b9e0544d 100644
--- a/libibverbs/init.c
+++ b/libibverbs/init.c
@@ -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,