mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
Cleanup: Simplify userspace abd_free_chunks()
Clang's static analyzer complained that we could use after free here if the inner loop ever iterated. That is a false positive, but upon inspection, the userland abd_alloc_chunks() function never will put multiple consecutive pages into a `struct scatterlist`, so there is no need to loop. We delete the inner loop. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Closes #14042
This commit is contained in:
parent
6ae2f90888
commit
9a8039439a
@ -597,11 +597,9 @@ abd_free_chunks(abd_t *abd)
|
|||||||
struct scatterlist *sg;
|
struct scatterlist *sg;
|
||||||
|
|
||||||
abd_for_each_sg(abd, sg, n, i) {
|
abd_for_each_sg(abd, sg, n, i) {
|
||||||
for (int j = 0; j < sg->length; j += PAGESIZE) {
|
struct page *p = nth_page(sg_page(sg), 0);
|
||||||
struct page *p = nth_page(sg_page(sg), j >> PAGE_SHIFT);
|
|
||||||
umem_free(p, PAGESIZE);
|
umem_free(p, PAGESIZE);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
abd_free_sg_table(abd);
|
abd_free_sg_table(abd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user