[pve-devel] applied: [PATCH cluster] pmxcfs: dcdb: fix returned pointer value:

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Sep 2 11:06:35 CEST 2019


On 9/2/19 10:47 AM, Wolfgang Bumiller wrote:
> Commit 926f961f62f5 used a new temporary pointer variable
> for type correctness, but the return value was still using
> the previous variable which had not been moved forward
> anymore.
> 
> Fixes: 926f961f62f5 ("pmxcfs dcdb: fix pointer void* aritmethic")
> Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
> ---
> Not sure if you're already on this, but I thought I'd give it a 2nd set
> of eyes anyway, and quickly ran into the issue on my cluster since it
> garbled root's .ssh/authorized_keys ;-)
> (which made bisecting this rather inconvenient >.-' )

While I was on it, this looks nice enough and correct: applied, thanks!

> 
> (This should fix martin's issue)
> 
> Also added a missing const and removed the extra cast (from/to void*
> should always work without it!)
> 
>  data/src/dcdb.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/data/src/dcdb.c b/data/src/dcdb.c
> index f6b0f86..df75389 100644
> --- a/data/src/dcdb.c
> +++ b/data/src/dcdb.c
> @@ -185,7 +185,7 @@ dcdb_parse_fuse_message(
>  		return FALSE;
>  	}
>  
> -	uint8_t *msg_ptr = (uint8_t *) msg;
> +	const uint8_t *msg_ptr = msg;
>  
>  	*size = *((guint32 *)msg_ptr);
>  	msg_ptr += 4; msg_len -= 4;
> @@ -233,7 +233,7 @@ dcdb_parse_fuse_message(
>  		*to = NULL;
>  	}
>  
> -	*buf = (*size) ? msg : NULL;
> +	*buf = (*size) ? (const char*)msg_ptr : NULL;
>  
>  	return TRUE;
>  }
> 





More information about the pve-devel mailing list