linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Long Li <longli@exchange.microsoft.com>
Cc: devel@linuxdriverproject.org,
	Haiyang Zhang <haiyangz@microsoft.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hv: use substraction to update ring buffer index
Date: Thu, 5 Jan 2017 14:48:04 +0300	[thread overview]
Message-ID: <20170105114804.GE13756@mwanda> (raw)
In-Reply-To: <20170105113955.GD13756@mwanda>

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

  reply	other threads:[~2017-01-05 11:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-05  4:08 [PATCH] hv: use substraction to update ring buffer index Long Li
2017-01-05 11:39 ` Dan Carpenter
2017-01-05 11:48   ` Dan Carpenter [this message]
2017-01-07  7:15   ` Long Li
2017-01-16  3:12 ` Dexuan Cui
2017-01-20 21:15   ` Long Li

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=20170105114804.GE13756@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=devel@linuxdriverproject.org \
    --cc=haiyangz@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longli@exchange.microsoft.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).