]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
i3c: mipi-i3c-hci: Stop reading Extended Capabilities if capability ID is 0
authorAdrian Hunter <adrian.hunter@intel.com>
Tue, 6 Jan 2026 16:44:07 +0000 (18:44 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Wed, 14 Jan 2026 14:53:33 +0000 (15:53 +0100)
Extended Capability ID value 0 is special.  It signifies the end of the
list.  Stop reading Extended Capabilities if capability ID is 0.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260106164416.67074-3-adrian.hunter@intel.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/i3c/master/mipi-i3c-hci/ext_caps.c

index 40939af0b0e355e819ce875e2b148e477a1e37dd..024bccf23fd051777807560660cd4f3312dbf33c 100644 (file)
@@ -271,7 +271,7 @@ int i3c_hci_parse_ext_caps(struct i3c_hci *hci)
                cap_length = FIELD_GET(CAP_HEADER_LENGTH, cap_header);
                dev_dbg(&hci->master.dev, "id=0x%02x length=%d",
                        cap_id, cap_length);
-               if (!cap_length)
+               if (!cap_id || !cap_length)
                        break;
                if (curr_cap + cap_length * 4 >= end) {
                        dev_err(&hci->master.dev,