|
@@ -296,7 +296,6 @@ static inline int virtqueue_add(struct virtqueue *_vq,
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
|
|
- BUG_ON(total_sg > vq->vring.num);
|
|
|
|
BUG_ON(total_sg == 0);
|
|
BUG_ON(total_sg == 0);
|
|
|
|
|
|
head = vq->free_head;
|
|
head = vq->free_head;
|
|
@@ -305,8 +304,10 @@ static inline int virtqueue_add(struct virtqueue *_vq,
|
|
* buffers, then go indirect. FIXME: tune this threshold */
|
|
* buffers, then go indirect. FIXME: tune this threshold */
|
|
if (vq->indirect && total_sg > 1 && vq->vq.num_free)
|
|
if (vq->indirect && total_sg > 1 && vq->vq.num_free)
|
|
desc = alloc_indirect(_vq, total_sg, gfp);
|
|
desc = alloc_indirect(_vq, total_sg, gfp);
|
|
- else
|
|
|
|
|
|
+ else {
|
|
desc = NULL;
|
|
desc = NULL;
|
|
|
|
+ WARN_ON_ONCE(total_sg > vq->vring.num && !vq->indirect);
|
|
|
|
+ }
|
|
|
|
|
|
if (desc) {
|
|
if (desc) {
|
|
/* Use a single buffer which doesn't continue */
|
|
/* Use a single buffer which doesn't continue */
|