[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 2/8] xen/hypfs: switch write function handles to const
On 16.12.20 17:08, Jan Beulich wrote:
On 09.12.2020 17:09, Juergen Gross wrote:
--- a/xen/include/xen/guest_access.h
+++ b/xen/include/xen/guest_access.h
@@ -26,6 +26,11 @@
type *_x = (hnd).p; \
(XEN_GUEST_HANDLE_PARAM(type)) { _x }; \
})
+/* Same for casting to a const type. */
+#define guest_handle_const_cast(hnd, type) ({ \
+ const type *_x = (const type *)((hnd).p); \
+ (XEN_GUEST_HANDLE_PARAM(const_##type)) { _x }; \
+})
Afaict this allow casting from e.g. uint to const_ulong. We
don't want to permit this (i.e. if really needed one is to
go through two steps). I think all it takes is dropping the
cast:
#define guest_handle_const_cast(hnd, type) ({ \
const type *_x = (hnd).p; \
(XEN_GUEST_HANDLE_PARAM(const_##type)) { _x }; \
})
With this
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
and I'd be okay making the adjustment while committing
(provided it works and I didn't overlook anything).
At least it is still compiling, and I guess that was the main
concern.
Juergen
Attachment:
OpenPGP_0xB0DE9DD628BF132F.asc
Description: application/pgp-keys
Attachment:
OpenPGP_signature
Description: OpenPGP digital signature
|