All of lore.kernel.org
 help / color / mirror / Atom feed
From: Othman, Ossama <ossama.othman@intel.com>
To: ell@lists.01.org
Subject: RE: [PATCH] util: Fix C++ invalid pointer conversion
Date: Tue, 10 Nov 2020 01:07:28 +0000	[thread overview]
Message-ID: <36e83abf99be4ae6940ef0aa075dba44@intel.com> (raw)
In-Reply-To: <20201106170951.159439-1-ossama.othman@intel.com>

[-- 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

           reply	other threads:[~2020-11-10  1:07 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20201106170951.159439-1-ossama.othman@intel.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=36e83abf99be4ae6940ef0aa075dba44@intel.com \
    --to=ossama.othman@intel.com \
    --cc=ell@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.