From: Ian Campbell Subject: Re: [PATCH] xen: correct definition of uintptr_t on 32-bit platforms. Date: Wed, 12 Jun 2013 10:06:05 +0100 Message-ID: <1371027965.24512.368.camel@zakaz.uk.xensource.com> References: <1370351784-13275-1-git-send-email-ian.campbell@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1370351784-13275-1-git-send-email-ian.campbell@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: keir@xen.org, ian.jackson@eu.citrix.com, jbeulich@suse.com List-Id: xen-devel@lists.xenproject.org On Tue, 2013-06-04 at 14:16 +0100, Ian Campbell wrote: > Currently uintptr_t is unsigned long for both 32- and 64- bit platforms but > __PRIPTR_PREFIX is just "" on 32-bit leading to: > > error: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Werror=format] > > It was a bit of a tossup between changing __PREPTR_PREFIX and changing the > definition of uintptr_t. I went with the latter since it is consistent with > glibc. > > Tested with: > printk("uintptr %"PRIuPTR"\n", (uintptr_t)a_convenient_local_var); > in a conveniently built place on unstable (x86_64, arm32, arm64) and Xen 4.2 > (x86_32p & x86_64). > > This error will be exposed by the fixes for XSA55 and therefore will need to > be backported along with those. After discussing with Ian J we decided that rather than add yet more complexity / dependencies to XSA-55 it would be better for him to carry his existing workaround (#define ELF_PRIPTR, or some similar name) and to fix the issue with uintptr_t vs. PRIuPTR after XSA-55 was done. This is 4.4 material IMHO. Ian. > > Signed-off-by: Ian Campbell > Cc: ian.jackson@eu.citrix.com > Cc: keir@xen.org > Cc: jbeulich@suse.com > --- > xen/include/xen/types.h | 4 ++++ > 1 files changed, 4 insertions(+), 0 deletions(-) > > diff --git a/xen/include/xen/types.h b/xen/include/xen/types.h > index 8596ded..641e1d1 100644 > --- a/xen/include/xen/types.h > +++ b/xen/include/xen/types.h > @@ -57,6 +57,10 @@ typedef __u32 __be32; > typedef __u64 __le64; > typedef __u64 __be64; > > +#if BITS_PER_LONG == 64 > typedef unsigned long uintptr_t; > +#else > +typedef unsigned int uintptr_t; > +#endif > > #endif /* __TYPES_H__ */