Re: fs/hfsplus/xattr.c: comparison of distinct pointer types lacks a cast
From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: 2014-05-25 08:48:54
Also in:
linux-fsdevel
Hi Christian, On Sun, May 25, 2014 at 3:42 AM, Christian Kujau [off-list ref] wrote:
/usr/local/src/linux-git/include/asm-generic/div64.h:43:28: warning:
comparison of distinct pointer types lacks a cast [enabled by default]
(void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
^
/usr/local/src/linux-git/fs/hfsplus/xattr.c:86:2: note: in expansion of
macro 'do_div'
do_div(tmp, node_size);
^
LD [M] fs/hfsplus/hfsplus.o
---------------------------------------------------------------
I don't fully understand the issue here, but xattr.c:86 reads:
do_div(tmp, node_size);"tmp" is "loff_t" which is "__kernel_loff_t", which is "long long", i.e. signed, while include/asm-generic/div64.h compares its type with "uint64_t". As inode sizes are positive, it should be safe to change the type of "tmp" to "u64". Does that make the warning go away?
Now, "git log -S do_div --source fs/hfsplus/xattr.c" brought up the following commit from Geert, introducing do_div() to xattr.c commit a99b7069aab8fc3fb4f26d15795dc280b52e38b1 HEAD Author: Geert Uytterhoeven [off-list ref] Date: Thu Nov 14 14:32:18 2013 -0800 hfsplus: Fix undefined __divdi3 in hfsplus_init_header_node() Reverting this commit makes the warning above go away, but I doubt this would be the correct solution here :-)
Indeed ;-)
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds