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

Hitoshi Mitake mitake.hitoshi at gmail.com
Mon Apr 1 03:20:23 CEST 2013


At Mon, 01 Apr 2013 09:37:42 +0900,
MORITA Kazutaka wrote:
> 
> 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.
> 

Sorry for that. I'll fix them in v2.

Thanks,
Hitoshi



More information about the sheepdog mailing list