* Patch for strncmp use in s390 in 2.5
@ 2003-05-28 20:20 Pete Zaitcev
2003-05-28 20:34 ` Richard B. Johnson
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Pete Zaitcev @ 2003-05-28 20:20 UTC (permalink / raw)
To: linux390; +Cc: Pete Zaitcev, James Antill, linux-kernel
Martin & others:
I didn't see this posted before. Sorry if I missed it.
It's a harmless buglet which causes false positives with correctness
checking tools, and so annoys me.
Cheers,
-- Pete
--- linux-2.5.69-bk12/arch/s390/kernel/setup.c 2003-05-11 12:56:15.000000000 -0700
+++ linux-2.5.69-bk12-s390/arch/s390/kernel/setup.c 2003-05-28 13:01:54.000000000 -0700
@@ -165,15 +165,15 @@
static int __init conmode_setup(char *str)
{
#if defined(CONFIG_SCLP_CONSOLE)
- if (strncmp(str, "hwc", 4) == 0 || strncmp(str, "sclp", 5) == 0)
+ if (strncmp(str, "hwc", 3) == 0 || strncmp(str, "sclp", 4) == 0)
SET_CONSOLE_SCLP;
#endif
#if defined(CONFIG_TN3215_CONSOLE)
- if (strncmp(str, "3215", 5) == 0)
+ if (strncmp(str, "3215", 4) == 0)
SET_CONSOLE_3215;
#endif
#if defined(CONFIG_TN3270_CONSOLE)
- if (strncmp(str, "3270", 5) == 0)
+ if (strncmp(str, "3270", 4) == 0)
SET_CONSOLE_3270;
#endif
return 1;
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Patch for strncmp use in s390 in 2.5
2003-05-28 20:20 Patch for strncmp use in s390 in 2.5 Pete Zaitcev
@ 2003-05-28 20:34 ` Richard B. Johnson
2003-05-28 20:51 ` Patch for strncmp use in s390 (sclp) Pete Zaitcev
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Richard B. Johnson @ 2003-05-28 20:34 UTC (permalink / raw)
To: Pete Zaitcev; +Cc: linux390, James Antill, linux-kernel
On Wed, 28 May 2003, Pete Zaitcev wrote:
> Martin & others:
>
> I didn't see this posted before. Sorry if I missed it.
> It's a harmless buglet which causes false positives with correctness
> checking tools, and so annoys me.
>
> Cheers,
> -- Pete
Maybe it should be changed to memcmp() with the null-byte included
in the length since the compare length is already defined in the code.
This should reduce the overhead at the same time it gets rid
of the false positive.
[SNIPPED...]
Cheers,
Dick Johnson
Penguin : Linux version 2.4.20 on an i686 machine (797.90 BogoMips).
Why is the government concerned about the lunatic fringe? Think about it.
^ permalink raw reply [flat|nested] 5+ messages in thread* Patch for strncmp use in s390 (sclp)
2003-05-28 20:20 Patch for strncmp use in s390 in 2.5 Pete Zaitcev
2003-05-28 20:34 ` Richard B. Johnson
@ 2003-05-28 20:51 ` Pete Zaitcev
2003-05-28 21:55 ` Patch for strncmp use in s390 in 2.5 Richard Braakman
[not found] ` <mailman.1054159021.10246.linux-kernel2news@redhat.com>
3 siblings, 0 replies; 5+ messages in thread
From: Pete Zaitcev @ 2003-05-28 20:51 UTC (permalink / raw)
To: Pete Zaitcev; +Cc: linux390, James Antill, linux-kernel
This one is different from the one in setup.c, being an actual bug.
-- Pete
--- linux-2.4.20-1.1931.2.199.z0/drivers/s390/char/sclp_tty.c 2003-05-19 17:16:59.000000000 -0400
+++ linux-2.4.20-1.1931.2.199.z1/drivers/s390/char/sclp_tty.c 2003-05-28 12:40:01.000000000 -0400
@@ -500,7 +500,7 @@
memcpy(sclp_tty->flip.char_buf_ptr, buf, count);
if (count < 2 ||
(strncmp ((const char *) buf + count - 2, "^n", 2) &&
- strncmp ((const char *) buf + count - 2, "\0252n", 2))) {
+ strncmp ((const char *) buf + count - 2, "\252n", 2))) {
sclp_tty->flip.char_buf_ptr[count] = '\n';
count++;
} else
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Patch for strncmp use in s390 in 2.5
2003-05-28 20:20 Patch for strncmp use in s390 in 2.5 Pete Zaitcev
2003-05-28 20:34 ` Richard B. Johnson
2003-05-28 20:51 ` Patch for strncmp use in s390 (sclp) Pete Zaitcev
@ 2003-05-28 21:55 ` Richard Braakman
[not found] ` <mailman.1054159021.10246.linux-kernel2news@redhat.com>
3 siblings, 0 replies; 5+ messages in thread
From: Richard Braakman @ 2003-05-28 21:55 UTC (permalink / raw)
To: linux-kernel
On Wed, May 28, 2003 at 04:20:19PM -0400, Pete Zaitcev wrote:
> I didn't see this posted before. Sorry if I missed it.
> It's a harmless buglet which causes false positives with correctness
> checking tools, and so annoys me.
Are you sure it's harmless? Your patch changes the meaning from an
exact match to a prefix match. I think it's intended to be an exact
match, but I don't know why it doesn't just use strcmp().
Richard Braakman
^ permalink raw reply [flat|nested] 5+ messages in thread[parent not found: <mailman.1054159021.10246.linux-kernel2news@redhat.com>]
* Re: Patch for strncmp use in s390 in 2.5
[not found] ` <mailman.1054159021.10246.linux-kernel2news@redhat.com>
@ 2003-05-28 23:45 ` Pete Zaitcev
0 siblings, 0 replies; 5+ messages in thread
From: Pete Zaitcev @ 2003-05-28 23:45 UTC (permalink / raw)
To: Richard Braakman; +Cc: linux-kernel
>> I didn't see this posted before. Sorry if I missed it.
>> It's a harmless buglet which causes false positives with correctness
>> checking tools, and so annoys me.
>
> Are you sure it's harmless? Your patch changes the meaning from an
> exact match to a prefix match. I think it's intended to be an exact
> match, but I don't know why it doesn't just use strcmp().
The buglet is harmless. Now, the fix perhaps not.
I think it may be better to replace it with strcmp, too.
-- Pete
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-05-28 23:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-28 20:20 Patch for strncmp use in s390 in 2.5 Pete Zaitcev
2003-05-28 20:34 ` Richard B. Johnson
2003-05-28 20:51 ` Patch for strncmp use in s390 (sclp) Pete Zaitcev
2003-05-28 21:55 ` Patch for strncmp use in s390 in 2.5 Richard Braakman
[not found] ` <mailman.1054159021.10246.linux-kernel2news@redhat.com>
2003-05-28 23:45 ` Pete Zaitcev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox