--- linux-2.6.11.src/include/asm-i386/string.h.orig Thu Mar 3 09:31:08 2005 +++ linux-2.6.11.src/include/asm-i386/string.h Tue Apr 5 18:34:28 2005 @@ -316,8 +345,16 @@ __asm__ __volatile__( return s; } -/* we might want to write optimized versions of these later */ -#define __constant_count_memset(s,c,count) __memset_generic((s),(c),(count)) +/* + * we might want to write optimized versions of this later + * for mow, just prevent common mistake of memset(a,c,0) + */ +void BUG_memset_with_zero_length(void); +static inline void * __constant_count_memset(void * s, int c, size_t count) +{ + if(!count) BUG_memset_with_zero_length(); + return __memset_generic(s,c,count); +} /* * memset(x,0,y) is a reasonably common thing to do, so we want to fill @@ -376,6 +413,7 @@ static inline void * __constant_c_and_co { switch (count) { case 0: + BUG_memset_with_zero_length(); return s; case 1: *(unsigned char *)s = pattern;