Skip to content

Commit fbafc3e

Browse files
committed
Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
Pull virtio fixes from Michael Tsirkin: "A couple of bugfixes: one for a regression" * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: virtio_blk: fix snprintf truncation compiler warning virtio_ring: fix syncs DMA memory with different direction
2 parents 861deac + b8e0792 commit fbafc3e

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

drivers/block/virtio_blk.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,12 +1019,12 @@ static void virtblk_config_changed(struct virtio_device *vdev)
10191019
static int init_vq(struct virtio_blk *vblk)
10201020
{
10211021
int err;
1022-
int i;
1022+
unsigned short i;
10231023
vq_callback_t **callbacks;
10241024
const char **names;
10251025
struct virtqueue **vqs;
10261026
unsigned short num_vqs;
1027-
unsigned int num_poll_vqs;
1027+
unsigned short num_poll_vqs;
10281028
struct virtio_device *vdev = vblk->vdev;
10291029
struct irq_affinity desc = { 0, };
10301030

@@ -1068,13 +1068,13 @@ static int init_vq(struct virtio_blk *vblk)
10681068

10691069
for (i = 0; i < num_vqs - num_poll_vqs; i++) {
10701070
callbacks[i] = virtblk_done;
1071-
snprintf(vblk->vqs[i].name, VQ_NAME_LEN, "req.%d", i);
1071+
snprintf(vblk->vqs[i].name, VQ_NAME_LEN, "req.%u", i);
10721072
names[i] = vblk->vqs[i].name;
10731073
}
10741074

10751075
for (; i < num_vqs; i++) {
10761076
callbacks[i] = NULL;
1077-
snprintf(vblk->vqs[i].name, VQ_NAME_LEN, "req_poll.%d", i);
1077+
snprintf(vblk->vqs[i].name, VQ_NAME_LEN, "req_poll.%u", i);
10781078
names[i] = vblk->vqs[i].name;
10791079
}
10801080

drivers/virtio/virtio_ring.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3219,8 +3219,7 @@ void virtqueue_dma_sync_single_range_for_cpu(struct virtqueue *_vq,
32193219
if (!vq->use_dma_api)
32203220
return;
32213221

3222-
dma_sync_single_range_for_cpu(dev, addr, offset, size,
3223-
DMA_BIDIRECTIONAL);
3222+
dma_sync_single_range_for_cpu(dev, addr, offset, size, dir);
32243223
}
32253224
EXPORT_SYMBOL_GPL(virtqueue_dma_sync_single_range_for_cpu);
32263225

@@ -3246,8 +3245,7 @@ void virtqueue_dma_sync_single_range_for_device(struct virtqueue *_vq,
32463245
if (!vq->use_dma_api)
32473246
return;
32483247

3249-
dma_sync_single_range_for_device(dev, addr, offset, size,
3250-
DMA_BIDIRECTIONAL);
3248+
dma_sync_single_range_for_device(dev, addr, offset, size, dir);
32513249
}
32523250
EXPORT_SYMBOL_GPL(virtqueue_dma_sync_single_range_for_device);
32533251

0 commit comments

Comments
 (0)