libhsakmt: Sanity check node_id for NUMA binding

Ignore requests to bind to invalid NUMA nodes. This affects only
legacy applications (such as KFDTest) that allocate system memory
as paged memory with a GPU node ID.

Change-Id: I81e514af6d0c1ab2ed5229adeeca1fa0ab2a0685
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Этот коммит содержится в:
Felix Kuehling
2019-07-12 17:48:27 -04:00
родитель 20cd954fe8
Коммит 4d7b0990e4
+6
Просмотреть файл
@@ -1469,6 +1469,12 @@ static int bind_mem_to_numa(uint32_t node_id, void *mem,
num_node = numa_num_task_nodes();
/* Ignore binding requests to invalid nodes IDs */
if (node_id >= (unsigned)num_node) {
pr_warn("node_id %d >= num_node %d\n", node_id, num_node);
return 0;
}
if (num_node > 1) {
node_mask = numa_bitmask_alloc(num_node);
if (!node_mask)