return 1;
 }
 
+#define ACPIID_LEN (ACPIHID_UID_LEN + ACPIHID_HID_LEN)
+
 static int __init parse_ivrs_acpihid(char *str)
 {
        u32 seg = 0, bus, dev, fn;
        char *hid, *uid, *p, *addr;
-       char acpiid[ACPIHID_UID_LEN + ACPIHID_HID_LEN] = {0};
+       char acpiid[ACPIID_LEN] = {0};
        int i;
 
        addr = strchr(str, '@');
        if (!addr) {
+               addr = strchr(str, '=');
+               if (!addr)
+                       goto not_found;
+
+               ++addr;
+
+               if (strlen(addr) > ACPIID_LEN)
+                       goto not_found;
+
                if (sscanf(str, "[%x:%x.%x]=%s", &bus, &dev, &fn, acpiid) == 4 ||
                    sscanf(str, "[%x:%x:%x.%x]=%s", &seg, &bus, &dev, &fn, acpiid) == 5) {
                        pr_warn("ivrs_acpihid%s option format deprecated; use ivrs_acpihid=%s@%04x:%02x:%02x.%d instead\n",
        /* We have the '@', make it the terminator to get just the acpiid */
        *addr++ = 0;
 
+       if (strlen(str) > ACPIID_LEN + 1)
+               goto not_found;
+
        if (sscanf(str, "=%s", acpiid) != 1)
                goto not_found;