[sheepdog] [PATCH] sheep: read timestmap with correct size in do_epoch_log_read()

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Mon Apr 1 02:37:42 CEST 2013


At Fri, 29 Mar 2013 21:25:32 +0900,
Hitoshi Mitake wrote:
> 
> do_epoch_log_read() reads timestamp with sizeof(timestamp). But the
> size should be sizeof(*timestamp). This would cause problems on 32bit
> architectures.
> 
> Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
> ---
>  sheep/store.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sheep/store.c b/sheep/store.c
> index c5101aa..2a551ba 100644
> --- a/sheep/store.c
> +++ b/sheep/store.c
> @@ -105,8 +105,8 @@ static int do_epoch_log_read(uint32_t epoch, struct sd_node *nodes, int len,
>  	nr_nodes = ret / sizeof(struct sd_node);
>  
>  	if (timestamp) {
> -		ret = xread(fd, timestamp, sizeof(timestamp));
> -		if (ret != sizeof(timestamp))
> +		ret = xread(fd, timestamp, sizeof(*timestamp));
> +		if (ret != sizeof(*timestamp))
>  			goto err;
>  	}

There is another sizeof(timestamp) in this function.

Thanks,

Kazutaka



More information about the sheepdog mailing list