Commit 68d23705 authored by Marek Szyprowski's avatar Marek Szyprowski Committed by Christoph Hellwig

scatterlist: protect parameters of the sg_table related macros

Add brackets to protect parameters of the recently added sg_table related
macros from side-effects.

Fixes: 709d6d73 ("scatterlist: add generic wrappers for iterating over sgtable objects")
Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 71cdec4f
...@@ -155,7 +155,7 @@ static inline void sg_set_buf(struct scatterlist *sg, const void *buf, ...@@ -155,7 +155,7 @@ static inline void sg_set_buf(struct scatterlist *sg, const void *buf,
* Loop over each sg element in the given sg_table object. * Loop over each sg element in the given sg_table object.
*/ */
#define for_each_sgtable_sg(sgt, sg, i) \ #define for_each_sgtable_sg(sgt, sg, i) \
for_each_sg(sgt->sgl, sg, sgt->orig_nents, i) for_each_sg((sgt)->sgl, sg, (sgt)->orig_nents, i)
/* /*
* Loop over each sg element in the given *DMA mapped* sg_table object. * Loop over each sg element in the given *DMA mapped* sg_table object.
...@@ -163,7 +163,7 @@ static inline void sg_set_buf(struct scatterlist *sg, const void *buf, ...@@ -163,7 +163,7 @@ static inline void sg_set_buf(struct scatterlist *sg, const void *buf,
* of the each element. * of the each element.
*/ */
#define for_each_sgtable_dma_sg(sgt, sg, i) \ #define for_each_sgtable_dma_sg(sgt, sg, i) \
for_each_sg(sgt->sgl, sg, sgt->nents, i) for_each_sg((sgt)->sgl, sg, (sgt)->nents, i)
/** /**
* sg_chain - Chain two sglists together * sg_chain - Chain two sglists together
...@@ -451,7 +451,7 @@ sg_page_iter_dma_address(struct sg_dma_page_iter *dma_iter) ...@@ -451,7 +451,7 @@ sg_page_iter_dma_address(struct sg_dma_page_iter *dma_iter)
* See also for_each_sg_page(). In each loop it operates on PAGE_SIZE unit. * See also for_each_sg_page(). In each loop it operates on PAGE_SIZE unit.
*/ */
#define for_each_sgtable_page(sgt, piter, pgoffset) \ #define for_each_sgtable_page(sgt, piter, pgoffset) \
for_each_sg_page(sgt->sgl, piter, sgt->orig_nents, pgoffset) for_each_sg_page((sgt)->sgl, piter, (sgt)->orig_nents, pgoffset)
/** /**
* for_each_sgtable_dma_page - iterate over the DMA mapped sg_table object * for_each_sgtable_dma_page - iterate over the DMA mapped sg_table object
...@@ -465,7 +465,7 @@ sg_page_iter_dma_address(struct sg_dma_page_iter *dma_iter) ...@@ -465,7 +465,7 @@ sg_page_iter_dma_address(struct sg_dma_page_iter *dma_iter)
* unit. * unit.
*/ */
#define for_each_sgtable_dma_page(sgt, dma_iter, pgoffset) \ #define for_each_sgtable_dma_page(sgt, dma_iter, pgoffset) \
for_each_sg_dma_page(sgt->sgl, dma_iter, sgt->nents, pgoffset) for_each_sg_dma_page((sgt)->sgl, dma_iter, (sgt)->nents, pgoffset)
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment