From: Dan Carpenter <dan.carpenter@oracle.com>
To: tn@semihalf.com
Cc: linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: [bug report] ACPI: Add new IORT functions to support MSI domain handling
Date: Thu, 13 Jun 2019 09:54:10 +0300 [thread overview]
Message-ID: <20190613065410.GB16334@mwanda> (raw)
Hello Tomasz Nowicki,
The patch 4bf2efd26d76: "ACPI: Add new IORT functions to support MSI
domain handling" from Sep 12, 2016, leads to the following static
checker warning:
drivers/acpi/arm64/iort.c:628 iort_dev_find_its_id()
warn: array off by one? 'its->identifiers[idx]'
drivers/acpi/arm64/iort.c
589 /**
590 * iort_dev_find_its_id() - Find the ITS identifier for a device
591 * @dev: The device.
592 * @req_id: Device's requester ID
593 * @idx: Index of the ITS identifier list.
594 * @its_id: ITS identifier.
595 *
596 * Returns: 0 on success, appropriate error value otherwise
597 */
598 static int iort_dev_find_its_id(struct device *dev, u32 req_id,
599 unsigned int idx, int *its_id)
600 {
601 struct acpi_iort_its_group *its;
602 struct acpi_iort_node *node;
603
604 node = iort_find_dev_node(dev);
605 if (!node)
606 return -ENXIO;
607
608 node = iort_node_map_id(node, req_id, NULL, IORT_MSI_TYPE);
609 if (!node)
610 return -ENXIO;
611
612 /* Move to ITS specific data */
613 its = (struct acpi_iort_its_group *)node->node_data;
614 if (idx > its->its_count) {
^^^^^^^^^^^^^^^^^^^^
I wasn't able to find any information about how its->its_count is set
but it looks to me that is off by one.
615 dev_err(dev, "requested ITS ID index [%d] is greater than available [%d]\n",
616 idx, its->its_count);
617 return -ENXIO;
618 }
619
620 *its_id = its->identifiers[idx];
621 return 0;
622 }
regards,
dan carpenter
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: tn@semihalf.com
Cc: linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: [bug report] ACPI: Add new IORT functions to support MSI domain handling
Date: Thu, 13 Jun 2019 09:54:10 +0300 [thread overview]
Message-ID: <20190613065410.GB16334@mwanda> (raw)
Hello Tomasz Nowicki,
The patch 4bf2efd26d76: "ACPI: Add new IORT functions to support MSI
domain handling" from Sep 12, 2016, leads to the following static
checker warning:
drivers/acpi/arm64/iort.c:628 iort_dev_find_its_id()
warn: array off by one? 'its->identifiers[idx]'
drivers/acpi/arm64/iort.c
589 /**
590 * iort_dev_find_its_id() - Find the ITS identifier for a device
591 * @dev: The device.
592 * @req_id: Device's requester ID
593 * @idx: Index of the ITS identifier list.
594 * @its_id: ITS identifier.
595 *
596 * Returns: 0 on success, appropriate error value otherwise
597 */
598 static int iort_dev_find_its_id(struct device *dev, u32 req_id,
599 unsigned int idx, int *its_id)
600 {
601 struct acpi_iort_its_group *its;
602 struct acpi_iort_node *node;
603
604 node = iort_find_dev_node(dev);
605 if (!node)
606 return -ENXIO;
607
608 node = iort_node_map_id(node, req_id, NULL, IORT_MSI_TYPE);
609 if (!node)
610 return -ENXIO;
611
612 /* Move to ITS specific data */
613 its = (struct acpi_iort_its_group *)node->node_data;
614 if (idx > its->its_count) {
^^^^^^^^^^^^^^^^^^^^
I wasn't able to find any information about how its->its_count is set
but it looks to me that is off by one.
615 dev_err(dev, "requested ITS ID index [%d] is greater than available [%d]\n",
616 idx, its->its_count);
617 return -ENXIO;
618 }
619
620 *its_id = its->identifiers[idx];
621 return 0;
622 }
regards,
dan carpenter
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2019-06-13 16:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-13 6:54 Dan Carpenter [this message]
2019-06-13 6:54 ` [bug report] ACPI: Add new IORT functions to support MSI domain handling Dan Carpenter
2019-06-13 9:30 ` Robin Murphy
2019-06-13 9:30 ` Robin Murphy
2019-06-14 1:03 ` Hanjun Guo
2019-06-14 1:03 ` Hanjun Guo
2019-06-14 10:09 ` Tomasz Nowicki
2019-06-14 10:09 ` Tomasz Nowicki
2019-06-14 14:28 ` Lorenzo Pieralisi
2019-06-14 14:28 ` Lorenzo Pieralisi
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=20190613065410.GB16334@mwanda \
--to=dan.carpenter@oracle.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=tn@semihalf.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.