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

* Re: [PATCH 1/8] Off-by-one(two) error in form factor detection
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Johan Hedberg @ 2011-08-22  8:29 UTC (permalink / raw)
  To: Pavel Raiskup; +Cc: linux-bluetooth, ovasik, stlman

Hi Pavel,

On Tue, Aug 16, 2011, Pavel Raiskup wrote:
> 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(-)

The patch doesn't apply (probably due to your email client splitting
lines). You might want to consider using git send-email instead:

Applying: Off-by-one(two) error in form factor detection
fatal: corrupt patch at line 10
Patch failed at 0001 Off-by-one(two) error in form factor detection

I also added Łukasz to CC since he sent a patch to this very same line a
month ago or so (and introduced the "+ 1). Łukasz, did you really verify
the correctness of your patch? (it seems you didn't)

Johan

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

* Re: [PATCH 1/8] Off-by-one(two) error in form factor detection
  2011-08-22  8:29 ` Johan Hedberg
@ 2011-08-23  5:07   ` Pavel Raiskup
  2011-08-23 15:36     ` Anderson Lizardo
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Raiskup @ 2011-08-23  5:07 UTC (permalink / raw)
  To: Johan Hedberg; +Cc: linux-bluetooth, ovasik, stlman

[-- Attachment #1: Type: text/plain, Size: 789 bytes --]

Hi Johan,

> On Tue, Aug 16, 2011, Pavel Raiskup wrote:
>> 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(-)
>
> The patch doesn't apply (probably due to your email client splitting
> lines). You might want to consider using git send-email instead:

sorry for that, I'll use send-email for the next time. For now I'm sending
patches again as attachment because I don't want to break this thread.

[-- Attachment #2: 0001-Off-by-one-two-error-in-form-factor-detection.patch --]
[-- Type: application/octet-stream, Size: 1099 bytes --]

From a028cb6da54e9b3cff830150842a12faed6a7860 Mon Sep 17 00:00:00 2001
From: Pavel Raiskup <praiskup@redhat.com>
Date: Thu, 11 Aug 2011 13:36:25 +0200
Subject: [PATCH 1/8] Off-by-one(two) error in form factor detection

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

* Re: [PATCH 1/8] Off-by-one(two) error in form factor detection
  2011-08-23  5:07   ` Pavel Raiskup
@ 2011-08-23 15:36     ` Anderson Lizardo
  0 siblings, 0 replies; 4+ messages in thread
From: Anderson Lizardo @ 2011-08-23 15:36 UTC (permalink / raw)
  To: Pavel Raiskup; +Cc: Johan Hedberg, linux-bluetooth, ovasik, stlman

Hi Pavel,

On Tue, Aug 23, 2011 at 1:07 AM, Pavel Raiskup <praiskup@redhat.com> wrote:
>> The patch doesn't apply (probably due to your email client splitting
>> lines). You might want to consider using git send-email instead:
>
> sorry for that, I'll use send-email for the next time. For now I'm sending
> patches again as attachment because I don't want to break this thread.

Just a tip: you can use --in-reply-to=<message-id> to make sure your
patch's email will be attached to a given thread.

<message-id> is the Message ID for the message you want to "reply"
with the new patch (which you can get from the message headers, look
for "Message-ID: ...").

HTH,
-- 
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil

^ permalink raw reply	[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).