|
@@ -191,7 +191,7 @@ static int pack_sg_list(struct scatterlist *sg, int start,
|
|
|
s = rest_of_page(data);
|
|
|
if (s > count)
|
|
|
s = count;
|
|
|
- BUG_ON(index > limit);
|
|
|
+ BUG_ON(index >= limit);
|
|
|
/* Make sure we don't terminate early. */
|
|
|
sg_unmark_end(&sg[index]);
|
|
|
sg_set_buf(&sg[index++], data, s);
|
|
@@ -236,6 +236,7 @@ pack_sg_list_p(struct scatterlist *sg, int start, int limit,
|
|
|
s = PAGE_SIZE - data_off;
|
|
|
if (s > count)
|
|
|
s = count;
|
|
|
+ BUG_ON(index >= limit);
|
|
|
/* Make sure we don't terminate early. */
|
|
|
sg_unmark_end(&sg[index]);
|
|
|
sg_set_page(&sg[index++], pdata[i++], s, data_off);
|