lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 13 Aug 2007 17:02:43 +0200
From:	Stefan Richter <stefanr@...6.in-berlin.de>
To:	sk malik <srikrishanmalik@...oo.co.in>
CC:	linux-kernel@...r.kernel.org
Subject: Re: why use memcpy when memmove is there?

sk malik wrote:
> memcpy copies a part of memory to some other location
> but It will not work for all cases of overlapping
> blocks.(if the start of destination block falls
> between the source block)
> 
> while memove copes with overlapping areas.
> 
> then why is memcpy present in the sources can't we
> simply do
> 
> "#define memcpy memmove" in include/linux/string.h
> 
> or am I missing something?

The restriction that memcpy is undefined for overlapping areas (IOW, is
only defined for non-overlapping areas) can be used for optimizations in
memcpy which are not possible in memmove.  An example, I suppose:
http://lxr.linux.no/source/arch/m68k/lib/string.c#L79
http://lxr.linux.no/source/arch/m68k/lib/string.c#L146
-- 
Stefan Richter
-=====-=-=== =--- -==-=
http://arcgraph.de/sr/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ