From: Jeremy Clifton <deaner92@yahoo.com>
To: Aluvala Sai Teja <aluvala.sai.teja@intel.com>,
"linux-bluetooth@vger.kernel.org"
<linux-bluetooth@vger.kernel.org>
Cc: "K, Kiran" <kiran.k@intel.com>
Subject: Re: [PATCH v1] Bluetooth: btintel: validate DDC record lengths
Date: Fri, 25 Sep 2026 10:02:43 -0400 [thread overview]
Message-ID: <44c92556-0d48-423f-8491-6985b86cd000@yahoo.com> (raw)
In-Reply-To: <MW5PR11MB5881C7B240C7AB3285E25C5DCC832@MW5PR11MB5881.namprd11.prod.outlook.com>
Sai,
If you are busy, I am willing to
send a follow-up patch myself with cmd_plen widened to unsigned int,
referencing your original patch.
Thoughts? Is that proper etiquette?
Jeremy Dean
On 9/22/26 8:43 AM, Aluvala Sai Teja wrote:
> Sai,
>
> A couple of things could be worth a second look here.
>
> cmd_plen is still declared as u8:
>
> u8 cmd_plen = fw_ptr[0] + 1U;
>
> The addition itself happens in a wider type due to integer promotion, but the result is truncated back down the moment it's stored in cmd_plen.
>
> So if fw_ptr[0] is 0xFF, cmd_plen still wraps to 0, the same as before this patch. The commit message says this parses the length "in unsigned storage so 0xFF does not wrap". It will wrap as soon as it is placed back into the u8 cmd_plen variable.
> [Sai] : Agreed .will change cmd_plen declaration to unsigned int in v2 patch
>
> It happens to get caught afterward by the cmd_plen < 3 check, since a wrapped value of 0 is less than 3. Is that the intended fix?
> [Sai] : Yes. DDC format is Length (1 byte), DDC ID (2 bytes), and DDC value . length and ddc id of 2 bytes are minimum expected bytes.
> The commit message seems to mismatch what is diffed.
>
> Also, the cmd_plen > U8_MAX check can never be true. Since cmd_plen is a u8, its value is bounded by U8_MAX by definition.
> There's no input that will make this branch fire.
> [Sai] : Agreed. This check will become valid once cmd_plen is declared as unsigned int
>
> Regards,
> Jeremy Dean
> ~
prev parent reply other threads:[~2026-09-25 14:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-18 8:38 [PATCH v1] Bluetooth: btintel: validate DDC record lengths Sai Teja Aluvala
2026-09-18 10:32 ` [v1] " bluez.test.bot
2026-09-22 2:40 ` [PATCH v1] Bluetooth: " Jeremy Dean
2026-09-22 12:43 ` Aluvala Sai Teja
2026-09-25 14:02 ` Jeremy Clifton [this message]
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=44c92556-0d48-423f-8491-6985b86cd000@yahoo.com \
--to=deaner92@yahoo.com \
--cc=aluvala.sai.teja@intel.com \
--cc=kiran.k@intel.com \
--cc=linux-bluetooth@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