From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752267AbdKMLFs (ORCPT ); Mon, 13 Nov 2017 06:05:48 -0500 Received: from ozlabs.org ([103.22.144.67]:55507 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750986AbdKMLFr (ORCPT ); Mon, 13 Nov 2017 06:05:47 -0500 From: Michael Ellerman To: Michal Suchanek , Benjamin Herrenschmidt , Paul Mackerras , Michal Suchanek , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] bootwrapper: mspsc.c: fix pointer-to-int-cast warnings In-Reply-To: <20171005112854.28115-1-msuchanek@suse.de> References: <20171005112854.28115-1-msuchanek@suse.de> Date: Mon, 13 Nov 2017 22:05:44 +1100 Message-ID: <87o9o6wi9j.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Michal, Thanks for trying to fix this. Michal Suchanek 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