Skip to content

Commit c5a0b6e

Browse files
committed
Merge tag 'vfio-v5.17-rc1' of git://github.com/awilliam/linux-vfio
Pull VFIO updates from Alex Williamson: - Fix sparse endian warnings in IGD code (Alex Williamson) - Balance kvzalloc with kvfree (Jiacheng Shi) * tag 'vfio-v5.17-rc1' of git://github.com/awilliam/linux-vfio: vfio/iommu_type1: replace kfree with kvfree vfio/pci: Resolve sparse endian warnings in IGD support
2 parents 41652aa + 2bed2ce commit c5a0b6e

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

drivers/vfio/pci/vfio_pci_igd.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -309,13 +309,14 @@ static ssize_t vfio_pci_igd_cfg_rw(struct vfio_pci_core_device *vdev,
309309

310310
if ((pos & 3) && size > 2) {
311311
u16 val;
312+
__le16 lval;
312313

313314
ret = pci_user_read_config_word(pdev, pos, &val);
314315
if (ret)
315316
return ret;
316317

317-
val = cpu_to_le16(val);
318-
if (copy_to_user(buf + count - size, &val, 2))
318+
lval = cpu_to_le16(val);
319+
if (copy_to_user(buf + count - size, &lval, 2))
319320
return -EFAULT;
320321

321322
pos += 2;
@@ -324,13 +325,14 @@ static ssize_t vfio_pci_igd_cfg_rw(struct vfio_pci_core_device *vdev,
324325

325326
while (size > 3) {
326327
u32 val;
328+
__le32 lval;
327329

328330
ret = pci_user_read_config_dword(pdev, pos, &val);
329331
if (ret)
330332
return ret;
331333

332-
val = cpu_to_le32(val);
333-
if (copy_to_user(buf + count - size, &val, 4))
334+
lval = cpu_to_le32(val);
335+
if (copy_to_user(buf + count - size, &lval, 4))
334336
return -EFAULT;
335337

336338
pos += 4;
@@ -339,13 +341,14 @@ static ssize_t vfio_pci_igd_cfg_rw(struct vfio_pci_core_device *vdev,
339341

340342
while (size >= 2) {
341343
u16 val;
344+
__le16 lval;
342345

343346
ret = pci_user_read_config_word(pdev, pos, &val);
344347
if (ret)
345348
return ret;
346349

347-
val = cpu_to_le16(val);
348-
if (copy_to_user(buf + count - size, &val, 2))
350+
lval = cpu_to_le16(val);
351+
if (copy_to_user(buf + count - size, &lval, 2))
349352
return -EFAULT;
350353

351354
pos += 2;

drivers/vfio/vfio_iommu_type1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ static int vfio_dma_bitmap_alloc(struct vfio_dma *dma, size_t pgsize)
256256

257257
static void vfio_dma_bitmap_free(struct vfio_dma *dma)
258258
{
259-
kfree(dma->bitmap);
259+
kvfree(dma->bitmap);
260260
dma->bitmap = NULL;
261261
}
262262

0 commit comments

Comments
 (0)