linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/8] Off-by-one(two) error in form factor detection
@ 2011-08-16  9:43 Pavel Raiskup
  2011-08-22  8:29 ` Johan Hedberg
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Raiskup @ 2011-08-16  9:43 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: ovasik@redhat.com

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-08-23 15:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-16  9:43 [PATCH 1/8] Off-by-one(two) error in form factor detection Pavel Raiskup
2011-08-22  8:29 ` Johan Hedberg
2011-08-23  5:07   ` Pavel Raiskup
2011-08-23 15:36     ` Anderson Lizardo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).