lkml.org 
[lkml]   [2017]   [Nov]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] bootwrapper: mspsc.c: fix pointer-to-int-cast warnings
Date
Hi Michal,

Thanks for trying to fix this.

Michal Suchanek <msuchanek@suse.de> writes:
> I get these warnings:
>
> ../arch/powerpc/boot/mpsc.c: In function 'mpsc_get_virtreg_of_phandle':
> ../arch/powerpc/boot/mpsc.c:113:35: warning: cast from pointer to
> integer of different size [-Wpointer-to-int-cast]
>
> ../arch/powerpc/boot/mpsc.c: In function 'mpsc_console_init':
> ../arch/powerpc/boot/mpsc.c:147:12: warning: cast from pointer to
> integer of different size [-Wpointer-to-int-cast]
>
> Presumably the patch below fixes these, and presumably the DT defines
> that pointes and integers have the same size in the DT so this is fine

Actually no it doesn't. A device tree doesn't contain pointers, and it
doesn't say anything about the size of a pointer on a platform that uses
that device tree.

phandles are not pointers, they are handles, and they are always 32-bit.
So this code is just wrong on 64-bit, you can't safely cast from a
64-bit pointer to a phandle.

But I think this warning has actually been fixed differently by commit:

866bfc75f40e ("powerpc: conditionally compile platform-specific serial drivers")

If you're still seeing the warning let me know.

cheers

\
 
 \ /
  Last update: 2017-11-13 12:06    [W:2.419 / U:0.000 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site