sctp_darn: fix __u64 format string issues on ppc64 / x86_64
On 64-bit powerpc, __u64 is defined to be unsigned long rather than
unsigned long long. This causes compiler warnings every time we
print a __u64 value with %PRIu64.
Since we cannot change or define our own u64 type in this case,
because it is within a structiure from the kernel, we just cast it
to uint64_t.
This behaviour can be reduced down to the following program:
#include <stdio.h>
#include <inttypes.h>
#include <netinet/sctp.h>
int main(void)
{
__u64 foo = 1;
printf("%" PRIu64 "\n", foo);
printf("%" PRIu64 "\n", (uint64_t) foo);
printf("__u64:%zu versus uint64_t:%zu\n", sizeof(__u64), sizeof(uint64_t));
return 0;
}
On x86_64:
$ gcc foo.c -Wall -O2
foo.c: In function ‘main’:
foo.c:9:2: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘__u64’ [-Wformat]
$ ./a.out
[...]
__u64:8 versus uint64_t:8
On ppc64:
$ gcc -Wall -O2 foo.c
$ ./a.out
[...]
__u64:8 versus uint64_t:8
So simply cast it in this case to uint64_t.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>