Skip to content

Commit

Permalink
[PATCH] fix: dmi_check_system
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Robert Love <rml@novell.com>
Cc: Andrey Panin <pazke@donpac.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Robert Love authored and Linus Torvalds committed Sep 7, 2005
1 parent ebad6a4 commit 640e803
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/i386/kernel/dmi_scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,9 @@ int dmi_check_system(struct dmi_system_id *list)
/* No match */
goto fail;
}
count++;
if (d->callback && d->callback(d))
break;
count++;
fail: d++;
}

Expand Down

0 comments on commit 640e803

Please sign in to comment.