lkml.org 
[lkml]   [2008]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [announce] new tree: "fix all build warnings, on all configs"
Linus Torvalds wrote:
>
> The old code was correct. Your code is shit. And you didn't fix
> _anything_.
>
>> case 5:
>> *(int *)to = *(int *)from;
>> - *((short *)to + 3) = *((short *)from + 3);
>> + *((char *)(to + 3)) = *((char *)(from + 3));
>> return to;
>
> Are you just making changes by randomly inserting and deleting characters
> until you don't see warnings? Or what?
>
> That thing is supposed to be a 5-byte memcpy. Not a "take a random byte
> from a random location and move it to another random location". That would
> be "randcpy()", not "memcpy()".
>

That is not a 5-byte memcopy. In *either* version!

In the "before" case, it copies bytes 0, 1, 2, 3, 6 and 7.
In the "after" case, it copies bytes 0, 1 and 2.

Presumably it *should* be:

*((char *)to + 4) = *((char *)from + 4);

-hpa


\
 
 \ /
  Last update: 2008-10-20 18:55    [W:0.148 / U:0.408 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site