afs: Clean up compiler warning casting ptr to int 92/14092/4
authorCheyenne Wills <cwills@sinenomine.net>
Fri, 6 Mar 2020 17:00:25 +0000 (10:00 -0700)
committerBenjamin Kaduk <kaduk@mit.edu>
Sun, 15 Mar 2020 00:45:24 +0000 (20:45 -0400)
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 <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>

src/afs/LINUX/osi_probe.c

index fc8153c..aea4bc6 100644 (file)
@@ -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);     \
     }                           \