[lkml]   [2005]   [Aug]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[patch] fix: dmi_check_system


1) dmi_check_system() returns the count of the number of
matches. Zero thus means no matches.
2) A match callback can return nonzero to stop the match

Bug: The count is incremented after we check for the nonzero return
value, so it does not reflect the actual count. We could say this is
intended, for some dumb reason, except that it means that a match on the
first check returns zero--no matches--if the callback returns nonzero.

Attached patch implements the count before calling the callback and thus
before potentially short-circuiting.

Robert Love

Signed-off-by: Robert Love <>

arch/i386/kernel/dmi_scan.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)

diff -urN linux-2.6.13/arch/i386/kernel/dmi_scan.c linux/arch/i386/kernel/dmi_scan.c
--- linux-2.6.13/arch/i386/kernel/dmi_scan.c 2005-08-29 14:28:33.000000000 -0400
+++ linux/arch/i386/kernel/dmi_scan.c 2005-08-29 14:35:06.000000000 -0400
@@ -218,9 +218,9 @@
/* No match */
goto fail;
+ count++;
if (d->callback && d->callback(d))
- count++;
fail: d++;

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-08-29 20:48    [W:0.024 / U:16.164 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site