public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ben Pfaff <blp@cs.stanford.edu>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Memory corruption in 8390.c ?
Date: Wed, 21 Jun 2006 11:03:10 -0700	[thread overview]
Message-ID: <87irmu5qu9.fsf@benpfaff.org> (raw)
In-Reply-To: <1150912459.15275.101.camel@localhost.localdomain> (Alan Cox's message of "Wed, 21 Jun 2006 18:54:19 +0100")

Alan Cox <alan@lxorguk.ukuu.org.uk> writes:

> Ar Mer, 2006-06-21 am 10:23 -0700, ysgrifennodd Ben Pfaff:
>> > +		memset(buf, 0, ETH_ZLEN);	/* more efficient than doing just the needed bits */
>> > +		memcpy(buf, data, ETH_ZLEN);
>> 
>> Is this really correct?  It zeros out ETH_ZLEN bytes only to
>> immediately copy over all of them again.
>
> When I did it originally I tested with rdtsc and its actually quicker to
> let it build the static memset the copy data over it than to do the
> extra maths and the variable length loop.
>
> Hence the comment

You are saying that this:
        memset(buf, 0, ETH_ZLEN);
        memcpy(buf, data, ETH_ZLEN);
is faster than this?
        memcpy(buf, data, ETH_ZLEN);

Because as far as I can tell they are equivalent.
-- 
Ben Pfaff 
email: blp@cs.stanford.edu
web: http://benpfaff.org

  reply	other threads:[~2006-06-21 18:03 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-21 16:28 Possible leaks in network drivers Eric Sesterhenn
2006-06-21 17:05 ` Randy.Dunlap
2006-06-21 17:13 ` Memory corruption in 8390.c ? (was Re: Possible leaks in network drivers) Alan Cox
2006-06-21 17:23   ` Memory corruption in 8390.c ? Ben Pfaff
2006-06-21 17:54     ` Alan Cox
2006-06-21 18:03       ` Ben Pfaff [this message]
2006-06-21 20:50         ` Alan Cox
2006-06-21 17:59     ` PATCH: Re: Memory corruption in 8390.c ? (and hp100 xirc2ps smc9194 ....) Alan Cox
2006-06-21 19:00       ` Olivier Galibert
2006-06-21 17:50   ` Possible leaks in network drivers Eric Sesterhenn
2006-06-22  1:41     ` Herbert Xu
2006-06-22  0:55   ` Memory corruption in 8390.c ? (was Re: Possible leaks in network drivers) Herbert Xu
2006-06-22  2:30     ` Herbert Xu
2006-06-22  8:22       ` Jeff Garzik
2006-06-22  8:29         ` Herbert Xu
2006-06-22  8:57           ` Jeff Garzik
2006-06-22  9:02             ` Herbert Xu
2006-06-22  9:12               ` Herbert Xu
2006-06-22  8:26       ` Memory corruption in 8390.c ? David Miller
2006-06-22  8:30         ` Herbert Xu
2006-06-22  8:34           ` David Miller
2006-06-22 11:34             ` Alan Cox
2006-06-22 11:29               ` Herbert Xu
2006-06-22 13:25                 ` Alan Cox
2006-06-23  3:32                   ` Jeff Garzik
2006-06-22 11:33               ` Arjan van de Ven
2006-06-22 12:00                 ` Erik Mouw
2006-06-22 13:10                 ` Alan Cox

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=87irmu5qu9.fsf@benpfaff.org \
    --to=blp@cs.stanford.edu \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /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