Re: [patch] A few things from 2.0.x (Was: Pre-2.1.80..)

Linus Torvalds (torvalds@transmeta.com)
Wed, 14 Jan 1998 13:05:13 -0800 (PST)


On Wed, 14 Jan 1998, Dr. Werner Fink wrote:
>
> Nothing dramatic ... only a few fixes in string-486.h done by Bernd Schmidt
> <crux@pool.informatik.rwth-aachen.de> for 2.0.30 but never applied to
> 2.1.x ... and two simple changes by my self (the PAGE_AGE_VALUE of 16 is
> a big one against PAGE_INITIAL_AGE of 3, avoid freeing a eventually not
> allocated page).

The "string-i486" part certainly still has bugs:

> @@ -416,9 +416,11 @@
>
> #define __HAVE_ARCH_MEMCPY
> #define memcpy(d,s,count) \
> -(__builtin_constant_p(count) ? \
> - __memcpy_c((d),(s),(count)) : \
> - __memcpy_g((d),(s),(count)))
> +(count == 0 \
> + ? d \
> + : __builtin_constant_p(count) \
> + ? __memcpy_c((d),(s),(count)) \
> + : __memcpy_g((d),(s),(count)))
>
> /*
> * These ought to get tweaked to do some cache priming.

The above makes the macro incorrectly use "count" twice. If count has side
effects, that's a serious problem that is very hard to find. Same goes for
the changes to memset().

The rest looks ok, but I'll continue to consider string-i486 totally
broken,

Linus