From 38d78e2496c3d242e44bad401ecffe15e3883388 Mon Sep 17 00:00:00 2001 From: Cheyenne Wills Date: Fri, 6 Mar 2020 10:00:25 -0700 Subject: [PATCH] afs: Clean up compiler warning casting ptr to int In osi_probe.c, the macro 'check_result' casts a pointer to an int which on older Linux kernels (e.g. 2.6.18) produces several lines with the C warning: ... warning: cast from pointer to integer of different size Change the cast from int to long int. Linux 2.6.18 doesn't provide intptr_t or uintptr_t, and stdint.h is not available to kernel modules. But the size of a pointer is the size of a long (see uintptr_t in linux/types.h - Linux 2.6.24+), so change the cast from int to long. Note that the this code by default only gets pulled in for older Linux kernels (e.g. 2.6.18). For newer kernels, ENABLE_LINUX_SYSCALL_PROBING is not defined, and so most of osi_probe.c is not built. Change-Id: If1b41e11c46f4a14ff5127ed4d602485645ddf2a Reviewed-on: https://gerrit.openafs.org/14092 Reviewed-by: Benjamin Kaduk Tested-by: BuildBot Reviewed-by: Andrew Deason --- src/afs/LINUX/osi_probe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/afs/LINUX/osi_probe.c b/src/afs/LINUX/osi_probe.c index fc8153c..aea4bc6 100644 --- a/src/afs/LINUX/osi_probe.c +++ b/src/afs/LINUX/osi_probe.c @@ -1173,14 +1173,14 @@ static void *try_harder(probectl *P, PROBETYPE *ptr, unsigned long datalen) if (probe_debug & 0x0001) { \ printk("<7>osi_probe: %s = 0x%016lx %s\n", P->symbol, (unsigned long)(x), (m)); \ } \ - if ((x) && ((int)(x)) != -ENOENT) { \ + if ((x) && ((long)(x)) != -ENOENT) { \ *method = (m); \ final_answer = (void *)(x); \ } \ } while (0) #else #define check_result(x,m) do { \ - if ((x) && ((int)(x)) != -ENOENT) { \ + if ((x) && ((long)(x)) != -ENOENT) { \ *method = (m); \ return (void *)(x); \ } \ -- 1.9.4