Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1551932

Re: [PATCH] hv: use substraction to update ring buffer index

From Dan Carpenter <dan.carpenter@oracle.com>
Newsgroups linux.kernel
Subject Re: [PATCH] hv: use substraction to update ring buffer index
Date 2017-01-05 13:00 +0100
Message-ID <sWeS6-2ug-33@gated-at.bofh.it> (permalink)
References <sW5ON-4Nm-1@gated-at.bofh.it> <sWeIp-2qW-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Jan 05, 2017 at 02:39:55PM +0300, Dan Carpenter wrote:
> > @@ -179,7 +180,8 @@ static u32 hv_copyfrom_ringbuffer(
> >  	memcpy(dest, ring_buffer + start_read_offset, destlen);
> >  
> >  	start_read_offset += destlen;
> > -	start_read_offset %= ring_buffer_size;
> > +	if (start_read_offset >= ring_buffer_size)
> > +		start_read_offset -= ring_buffer_size;
> 
> I totally don't understand the original code here.  We do the memset

I meant memcpy() not memset.

regards,
dan carpenter

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] hv: use substraction to update ring buffer index Long Li <longli@exchange.microsoft.com> - 2017-01-05 03:20 +0100
  Re: [PATCH] hv: use substraction to update ring buffer index Dan Carpenter <dan.carpenter@oracle.com> - 2017-01-05 12:50 +0100
    Re: [PATCH] hv: use substraction to update ring buffer index Dan Carpenter <dan.carpenter@oracle.com> - 2017-01-05 13:00 +0100
    RE: [PATCH] hv: use substraction to update ring buffer index Long Li <longli@microsoft.com> - 2017-01-07 08:20 +0100
  RE: [PATCH] hv: use substraction to update ring buffer index Dexuan Cui <decui@microsoft.com> - 2017-01-16 04:20 +0100

csiph-web