xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v2] xen: avoid type warning in xchg_xen_ulong
       [not found] <20170608085323.2209174-1-arnd@arndb.de>
@ 2017-06-08 11:36 ` Ian Abbott
  2017-06-08 18:12 ` Stefano Stabellini
  1 sibling, 0 replies; 3+ messages in thread
From: Ian Abbott @ 2017-06-08 11:36 UTC (permalink / raw)
  To: Arnd Bergmann, Stefano Stabellini
  Cc: xen-devel, Russell King, linux-arm-kernel, linux-kernel

On 2017-06-08 09:53, Arnd Bergmann wrote:
> The improved type-checking version of container_of() triggers a warning for
> xchg_xen_ulong, pointing out that 'xen_ulong_t' is unsigned, but atomic64_t
> contains a signed value:
>
> drivers/xen/events/events_2l.c: In function 'evtchn_2l_handle_events':
> drivers/xen/events/events_2l.c:187:1020: error: call to '__compiletime_assert_187' declared with attribute error: pointer type mismatch in container_of()
>
> This adds a cast to work around the warning.
>
> Cc: Ian Abbott <abbotti@mev.co.uk>
> Fixes: 85323a991d40 ("xen: arm: mandate EABI and use generic atomic operations.")
> Fixes: daa2ac80834d ("kernel.h: handle pointers to arrays better in container_of()")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> v2: found the correct warning message and updated the changelog
> ---
>  arch/arm/include/asm/xen/events.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/include/asm/xen/events.h b/arch/arm/include/asm/xen/events.h
> index 71e473d05fcc..620dc75362e5 100644
> --- a/arch/arm/include/asm/xen/events.h
> +++ b/arch/arm/include/asm/xen/events.h
> @@ -16,7 +16,7 @@ static inline int xen_irqs_disabled(struct pt_regs *regs)
>  	return raw_irqs_disabled_flags(regs->ARM_cpsr);
>  }
>
> -#define xchg_xen_ulong(ptr, val) atomic64_xchg(container_of((ptr),	\
> +#define xchg_xen_ulong(ptr, val) atomic64_xchg(container_of((long long*)(ptr),\
>  							    atomic64_t,	\
>  							    counter), (val))
>
>

Acked-by: Ian Abbott <abbotti@mev.co.uk>

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] xen: avoid type warning in xchg_xen_ulong
       [not found] <20170608085323.2209174-1-arnd@arndb.de>
  2017-06-08 11:36 ` [PATCH v2] xen: avoid type warning in xchg_xen_ulong Ian Abbott
@ 2017-06-08 18:12 ` Stefano Stabellini
  1 sibling, 0 replies; 3+ messages in thread
From: Stefano Stabellini @ 2017-06-08 18:12 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Stefano Stabellini, Russell King, linux-kernel, Ian Abbott,
	xen-devel, linux-arm-kernel

On Thu, 8 Jun 2017, Arnd Bergmann wrote:
> The improved type-checking version of container_of() triggers a warning for
> xchg_xen_ulong, pointing out that 'xen_ulong_t' is unsigned, but atomic64_t
> contains a signed value:
> 
> drivers/xen/events/events_2l.c: In function 'evtchn_2l_handle_events':
> drivers/xen/events/events_2l.c:187:1020: error: call to '__compiletime_assert_187' declared with attribute error: pointer type mismatch in container_of()
> 
> This adds a cast to work around the warning.
> 
> Cc: Ian Abbott <abbotti@mev.co.uk>
> Fixes: 85323a991d40 ("xen: arm: mandate EABI and use generic atomic operations.")
> Fixes: daa2ac80834d ("kernel.h: handle pointers to arrays better in container_of()")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>

I'll queue it up on xentip for Linux 4.13.


> ---
> v2: found the correct warning message and updated the changelog
> ---
>  arch/arm/include/asm/xen/events.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/include/asm/xen/events.h b/arch/arm/include/asm/xen/events.h
> index 71e473d05fcc..620dc75362e5 100644
> --- a/arch/arm/include/asm/xen/events.h
> +++ b/arch/arm/include/asm/xen/events.h
> @@ -16,7 +16,7 @@ static inline int xen_irqs_disabled(struct pt_regs *regs)
>  	return raw_irqs_disabled_flags(regs->ARM_cpsr);
>  }
>  
> -#define xchg_xen_ulong(ptr, val) atomic64_xchg(container_of((ptr),	\
> +#define xchg_xen_ulong(ptr, val) atomic64_xchg(container_of((long long*)(ptr),\
>  							    atomic64_t,	\
>  							    counter), (val))
>  
> -- 
> 2.9.0
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] xen: avoid type warning in xchg_xen_ulong
@ 2017-06-08  8:53 Arnd Bergmann
  0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2017-06-08  8:53 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: Arnd Bergmann, Russell King, linux-kernel, Ian Abbott, xen-devel,
	linux-arm-kernel

The improved type-checking version of container_of() triggers a warning for
xchg_xen_ulong, pointing out that 'xen_ulong_t' is unsigned, but atomic64_t
contains a signed value:

drivers/xen/events/events_2l.c: In function 'evtchn_2l_handle_events':
drivers/xen/events/events_2l.c:187:1020: error: call to '__compiletime_assert_187' declared with attribute error: pointer type mismatch in container_of()

This adds a cast to work around the warning.

Cc: Ian Abbott <abbotti@mev.co.uk>
Fixes: 85323a991d40 ("xen: arm: mandate EABI and use generic atomic operations.")
Fixes: daa2ac80834d ("kernel.h: handle pointers to arrays better in container_of()")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
v2: found the correct warning message and updated the changelog
---
 arch/arm/include/asm/xen/events.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/xen/events.h b/arch/arm/include/asm/xen/events.h
index 71e473d05fcc..620dc75362e5 100644
--- a/arch/arm/include/asm/xen/events.h
+++ b/arch/arm/include/asm/xen/events.h
@@ -16,7 +16,7 @@ static inline int xen_irqs_disabled(struct pt_regs *regs)
 	return raw_irqs_disabled_flags(regs->ARM_cpsr);
 }
 
-#define xchg_xen_ulong(ptr, val) atomic64_xchg(container_of((ptr),	\
+#define xchg_xen_ulong(ptr, val) atomic64_xchg(container_of((long long*)(ptr),\
 							    atomic64_t,	\
 							    counter), (val))
 
-- 
2.9.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-08 18:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20170608085323.2209174-1-arnd@arndb.de>
2017-06-08 11:36 ` [PATCH v2] xen: avoid type warning in xchg_xen_ulong Ian Abbott
2017-06-08 18:12 ` Stefano Stabellini
2017-06-08  8:53 Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).