Details
-
Bug
-
Resolution: Duplicate
-
Minor
-
None
-
None
-
None
-
3
-
15052
Description
When HAVE_HLIST_FOR_EACH_3ARG is defined, cfs_hlist_for_each_entry_safe (and similarly cfs_hlist_for_each_entry) are defined as this:
pos = NULL; hlist_for_each_entry_safe(tpos, n, head, member)
However if we have some code like:
for (i = 0; i < REMOTE_PERM_HASHSIZE; i++) cfs_hlist_for_each_entry_safe(lrp, node, next, hash + i, lrp_list) free_ll_remote_perm(lrp);
we end up actually doing:
for (i = 0; i < REMOTE_PERM_HASHSIZE; i++) pos = NULL; hlist_for_each_entry_safe(lrp, node, next, hash + i, lrp_list) free_ll_remote_perm(lrp);
which is probably not what was intended.
pos = NULL can be safely removed since it's an internal cursor. However that will generate some "unused" warnings on platforms where HAVE_HLIST_FOR_EACH_3ARG is defined.
The other option is to add braces around the call, such as:
for (i = 0; i < REMOTE_PERM_HASHSIZE; i++) { cfs_hlist_for_each_entry_safe(lrp, node, next, hash + i, lrp_list) free_ll_remote_perm(lrp); }
However that won't prevent a similar bug from being introduced in the future.
Attachments
Issue Links
- is related to
-
LU-3963 cleanup libcfs wrappers
- Resolved