mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-14 09:11:27 +00:00
Correct sg_next_inline() misuse.
Previously sg_next_inline() didn't check if this sg is last. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4822 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -2305,7 +2305,7 @@ static void q2t_load_cont_data_segments(struct q2t_prm *prm)
|
||||
(long long unsigned int)pci_dma_lo32(dma_addr),
|
||||
(int)sg_dma_len(prm->sg));
|
||||
|
||||
prm->sg = sg_next_inline(prm->sg);
|
||||
prm->sg = __sg_next_inline(prm->sg);
|
||||
}
|
||||
|
||||
TRACE_BUFFER("Continuation packet data",
|
||||
@@ -2366,7 +2366,7 @@ static void q2x_load_data_segments(struct q2t_prm *prm)
|
||||
(long long unsigned int)pci_dma_lo32(dma_addr),
|
||||
(int)sg_dma_len(prm->sg));
|
||||
|
||||
prm->sg = sg_next_inline(prm->sg);
|
||||
prm->sg = __sg_next_inline(prm->sg);
|
||||
}
|
||||
|
||||
TRACE_BUFFER("Scatter/gather, CTIO packet data", pkt,
|
||||
@@ -2428,7 +2428,7 @@ static void q24_load_data_segments(struct q2t_prm *prm)
|
||||
(long long unsigned int)pci_dma_lo32(dma_addr),
|
||||
(int)sg_dma_len(prm->sg));
|
||||
|
||||
prm->sg = sg_next_inline(prm->sg);
|
||||
prm->sg = __sg_next_inline(prm->sg);
|
||||
}
|
||||
|
||||
q2t_load_cont_data_segments(prm);
|
||||
|
||||
@@ -3756,7 +3756,7 @@ static inline void sg_set_page(struct scatterlist *sg, struct page *page,
|
||||
|
||||
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) */
|
||||
|
||||
static inline struct scatterlist *sg_next_inline(struct scatterlist *sg)
|
||||
static inline struct scatterlist *__sg_next_inline(struct scatterlist *sg)
|
||||
{
|
||||
sg++;
|
||||
if (unlikely(sg_is_chain(sg)))
|
||||
@@ -3765,6 +3765,14 @@ static inline struct scatterlist *sg_next_inline(struct scatterlist *sg)
|
||||
return sg;
|
||||
}
|
||||
|
||||
static inline struct scatterlist *sg_next_inline(struct scatterlist *sg)
|
||||
{
|
||||
if (sg_is_last(sg))
|
||||
return NULL;
|
||||
|
||||
return __sg_next_inline(sg);
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
|
||||
#ifndef __BACKPORT_LINUX_SCATTERLIST_H_TO_2_6_23__
|
||||
|
||||
@@ -3822,7 +3830,7 @@ static inline int __scst_get_buf(struct scst_cmd *cmd, int sg_cnt,
|
||||
res = sg->length;
|
||||
|
||||
cmd->get_sg_buf_entry_num++;
|
||||
cmd->get_sg_buf_cur_sg_entry = sg_next_inline(sg);
|
||||
cmd->get_sg_buf_cur_sg_entry = __sg_next_inline(sg);
|
||||
|
||||
out:
|
||||
return res;
|
||||
@@ -3924,7 +3932,7 @@ static inline int __scst_get_sg_page(struct scst_cmd *cmd, int sg_cnt,
|
||||
res = sg->length;
|
||||
|
||||
cmd->get_sg_buf_entry_num++;
|
||||
cmd->get_sg_buf_cur_sg_entry = sg_next_inline(sg);
|
||||
cmd->get_sg_buf_cur_sg_entry = __sg_next_inline(sg);
|
||||
|
||||
out:
|
||||
return res;
|
||||
|
||||
@@ -2995,7 +2995,7 @@ static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch,
|
||||
if (tsize > 0) {
|
||||
++j;
|
||||
if (j < count) {
|
||||
cur_sg = sg_next_inline(cur_sg);
|
||||
cur_sg = __sg_next_inline(cur_sg);
|
||||
dma_len = sg_dma_len(cur_sg);
|
||||
}
|
||||
}
|
||||
@@ -3050,7 +3050,7 @@ static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch,
|
||||
if (tsize > 0) {
|
||||
++j;
|
||||
if (j < count) {
|
||||
cur_sg = sg_next_inline(cur_sg);
|
||||
cur_sg = __sg_next_inline(cur_sg);
|
||||
dma_len = sg_dma_len(cur_sg);
|
||||
dma_addr =
|
||||
sg_dma_address(cur_sg);
|
||||
|
||||
Reference in New Issue
Block a user