diff --git a/sys/compat/linuxkpi/common/include/linux/scatterlist.h b/sys/compat/linuxkpi/common/include/linux/scatterlist.h index fe4bce06819d..b448262f3497 100644 --- a/sys/compat/linuxkpi/common/include/linux/scatterlist.h +++ b/sys/compat/linuxkpi/common/include/linux/scatterlist.h @@ -383,8 +383,6 @@ __sg_alloc_table_from_pages(struct sg_table *sgt, unsigned long seg_size; unsigned int j; - s = sg_next(s); - len = 0; for (j = cur + 1; j < count; ++j) { len += PAGE_SIZE; @@ -398,6 +396,8 @@ __sg_alloc_table_from_pages(struct sg_table *sgt, size -= seg_size; off = 0; cur = j; + + s = sg_next(s); } KASSERT(s != NULL, ("s is NULL after loop in __sg_alloc_table_from_pages()"));