From: Robert Love <rml@novell.com>
To: Mr Morton <akpm@osdl.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [patch] fix: dmi_check_system
Date: Mon, 29 Aug 2005 14:43:15 -0400 [thread overview]
Message-ID: <1125340995.27035.24.camel@betsy> (raw)
Background:
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
checking.
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 <rml@novell.com>
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))
break;
- count++;
fail: d++;
}
reply other threads:[~2005-08-29 18:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1125340995.27035.24.camel@betsy \
--to=rml@novell.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox