* RE: [PATCH] util: Fix C++ invalid pointer conversion
[not found] <20201106170951.159439-1-ossama.othman@intel.com>
@ 2020-11-10 1:07 ` Othman, Ossama
0 siblings, 0 replies; only message in thread
From: Othman, Ossama @ 2020-11-10 1:07 UTC (permalink / raw)
To: ell
[-- Attachment #1: Type: text/plain, Size: 1166 bytes --]
Apologies for the duplicate patches.
-Ossama
> -----Original Message-----
> From: Ossama Othman <ossama.othman@gmail.com>
> Sent: Friday, November 06, 2020 9:10 AM
> To: ell(a)lists.01.org
> Cc: Othman, Ossama <ossama.othman@intel.com>
> Subject: [PATCH] util: Fix C++ invalid pointer conversion
>
> Cast the void* arguments of l_secure_memcmp() to uint8_t* during
> assignment to the latter. C++ doesn't allow assignment of a void* to
> a pointer of another type without a cast. This allows <ell/util.h> to
> once again be used in C++ code.
> ---
> ell/util.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/ell/util.h b/ell/util.h
> index 0b3e1a8..f3dd57a 100644
> --- a/ell/util.h
> +++ b/ell/util.h
> @@ -351,8 +351,8 @@ const char *l_util_get_debugfs_path(void);
> static inline int l_secure_memcmp(const void *a, const void *b,
> size_t size)
> {
> - const volatile uint8_t *aa = a;
> - const volatile uint8_t *bb = b;
> + const volatile uint8_t *aa = (const uint8_t *) a;
> + const volatile uint8_t *bb = (const uint8_t *) b;
> int res = 0, diff, mask;
>
> /*
> --
> 2.25.1
^ permalink raw reply [flat|nested] only message in thread