mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-15 11:46:17 +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:
+11
-3
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user