diff options
author | Jason Ekstrand <[email protected]> | 2015-03-09 18:36:30 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-03-12 13:25:39 -0700 |
commit | 67388c1ef27e9ff4d7f60a496dbaea4b290dc741 (patch) | |
tree | adc0736dbb645761fbef69e484bcd7aa9f63bf53 /src/loader/pci_id_driver_map.h | |
parent | 547c760964bcad23a056e5156e4fefd7487c0192 (diff) |
util: Fix foreach_list_typed_safe when exec_node is not at offset 0.
__next and __prev are pointers to the structure containing the exec_node
link, not the embedded exec_node. NULL checks would fail unless the
embedded exec_node happened to be at offset 0 in the parent struct.
v2: Jason Ekstrand <[email protected]>:
Use "(__node)->__field.next != NULL" to check for the end of the list
instead of the "&__next->__field != NULL". The former is far more
obviously correct as it matches what the non-safe versions do. The
original code tried to avoid any use of __next as the client code may
delete it during its execution. However, since the looping condition is
checked after the iteration clause but before the client code is
executed, we know that __node is valid during the looping condition.
Signed-off-by: Jason Ekstrand <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Reviewed-by: Connor Abbott <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/loader/pci_id_driver_map.h')
0 files changed, 0 insertions, 0 deletions