Skip to content

Commit c48c0fd

Browse files
Thomas-fouriertakaswie
authored andcommitted
firewire: nosy: Fix dma_free_coherent() size
It looks like the buffer allocated and mapped in add_card() is done with size RCV_BUFFER_SIZE which is 16 KB and 4KB. Fixes: 2864682 ("firewire: new driver: nosy - IEEE 1394 traffic sniffer") Co-developed-by: Thomas Fourier <fourier.thomas@gmail.com> Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com> Co-developed-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/20251216165420.38355-2-fourier.thomas@gmail.com Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
1 parent 9448598 commit c48c0fd

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

drivers/firewire/nosy.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636

3737
static char driver_name[] = KBUILD_MODNAME;
3838

39+
#define RCV_BUFFER_SIZE (16 * 1024)
40+
3941
/* this is the physical layout of a PCL, its size is 128 bytes */
4042
struct pcl {
4143
__le32 next;
@@ -517,16 +519,14 @@ remove_card(struct pci_dev *dev)
517519
lynx->rcv_start_pcl, lynx->rcv_start_pcl_bus);
518520
dma_free_coherent(&lynx->pci_device->dev, sizeof(struct pcl),
519521
lynx->rcv_pcl, lynx->rcv_pcl_bus);
520-
dma_free_coherent(&lynx->pci_device->dev, PAGE_SIZE, lynx->rcv_buffer,
521-
lynx->rcv_buffer_bus);
522+
dma_free_coherent(&lynx->pci_device->dev, RCV_BUFFER_SIZE,
523+
lynx->rcv_buffer, lynx->rcv_buffer_bus);
522524

523525
iounmap(lynx->registers);
524526
pci_disable_device(dev);
525527
lynx_put(lynx);
526528
}
527529

528-
#define RCV_BUFFER_SIZE (16 * 1024)
529-
530530
static int
531531
add_card(struct pci_dev *dev, const struct pci_device_id *unused)
532532
{
@@ -680,7 +680,7 @@ add_card(struct pci_dev *dev, const struct pci_device_id *unused)
680680
dma_free_coherent(&lynx->pci_device->dev, sizeof(struct pcl),
681681
lynx->rcv_pcl, lynx->rcv_pcl_bus);
682682
if (lynx->rcv_buffer)
683-
dma_free_coherent(&lynx->pci_device->dev, PAGE_SIZE,
683+
dma_free_coherent(&lynx->pci_device->dev, RCV_BUFFER_SIZE,
684684
lynx->rcv_buffer, lynx->rcv_buffer_bus);
685685
iounmap(lynx->registers);
686686

0 commit comments

Comments
 (0)