[PATCH 1/8] Off-by-one(two) error in form factor detection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Indexing of chassis_map array has to be done like that:
    chassis_map[chassis_type * 2 - 1]

because if not, everything is shifted by one. When (e.g.) chassis_type
is 0x04 result should be "Low Profile Desktop" =>  "desktop" (not a
"Pizza Box" => "server"). Lets see the 2.6.1 document on:

http://www.dmtf.org/standards/smbios
---
 plugins/formfactor.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/plugins/formfactor.c b/plugins/formfactor.c
index 33a8b32..3b31927 100644
--- a/plugins/formfactor.c
+++ b/plugins/formfactor.c
@@ -104,7 +104,7 @@ static int formfactor_probe(struct btd_adapter *adapter)
 		return 0;
 	}

-	formfactor = chassis_map[chassis_type * 2 + 1];
+	formfactor = chassis_map[chassis_type * 2 - 1];
 	if (formfactor != NULL) {
 		if (g_str_equal(formfactor, "laptop") == TRUE)
 			minor |= (1 << 2) | (1 << 3);
--
1.7.4.4
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux