[Fwd: 2.2.0: kernel strstr() is broken]

Mark Lord (mlord@pobox.com)
Wed, 20 Jan 1999 18:12:27 -0500


Note: this is on a 400Mhz Pentium-II machine, with CONFIG_M686=y

-ml

-------- Original Message --------
Subject: 2.2.0: kernel strstr() is broken
Date: Wed, 20 Jan 1999 18:07:44 -0500
From: Mark Lord <mlord@pobox.com>
Organization: Real-Time Remedies Inc.
To: Linus Torvalds <torvalds@transmeta.com>
CC: kernel <linux-kernel@vger.rutgers.edu>,Alan Cox
<alan@lxorguk.ukuu.org.uk>

Hi.

The strstr() function appears to be broken for i386 with 2.2.0,
which in turn, breaks IOMEGA ATAPI ZIP drive detection in ide-probe.c
(which relies on a strstr() during the probe).

For example, this code (inserted into the kernel):
{
static int done = 0;
static char buf[64];
if (!done++) {
strcpy(buf,"This is a ZIP test");
printk("buf at %p: \"%s\"\n", buf, buf);
printk("strstr(buf,\"XXX\") gives %p\n",
strstr(buf,"XXX"));
printk("strstr(buf,\"Thi\") gives %p\n",
strstr(buf,"Thi"));
printk("strstr(buf,\"est\") gives %p\n",
strstr(buf,"est"));
printk("strstr(buf,\"ZIP\") gives %p\n",
strstr(buf,"ZIP"));
}
}

gives this output:

Jan 20 18:02:21 foxy kernel: buf at c026de20: "This is a ZIP test"
Jan 20 18:02:21 foxy kernel: strstr(buf,"XXX") gives c026de20
Jan 20 18:02:21 foxy kernel: strstr(buf,"Thi") gives c026de20
Jan 20 18:02:21 foxy kernel: strstr(buf,"est") gives c026de20
Jan 20 18:02:21 foxy kernel: strstr(buf,"ZIP") gives c026de20

strstr() is broken.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/