Skip to content

Commit

Permalink
rpmsg: virito: limit the buffer allocate from shared memory pool
Browse files Browse the repository at this point in the history
rpmsg_virtio_get_tx_buffer shouldn't allocate the number of
buffer bigger than the virtio ring length of sending

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
  • Loading branch information
xiaoxiang781216 committed Nov 6, 2020
1 parent 8e6fb73 commit ce6b001
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rpmsg/rpmsg_virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ static void *rpmsg_virtio_get_tx_buffer(struct rpmsg_virtio_device *rvdev,
#ifndef VIRTIO_SLAVE_ONLY
if (role == RPMSG_MASTER) {
data = virtqueue_get_buffer(rvdev->svq, len, idx);
if (!data) {
if (!data && rvdev->svq->vq_free_cnt) {
data = rpmsg_virtio_shm_pool_get_buffer(rvdev->shpool,
RPMSG_BUFFER_SIZE);
*len = RPMSG_BUFFER_SIZE;
Expand Down

0 comments on commit ce6b001

Please sign in to comment.