firewire: nosy: Fix dma_free_coherent() size
PATCH 1/1 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.
--- drivers/firewire/nosy.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/firewire/nosy.c +5 -5
@@ -494,6 +494,8 @@ irq_handler(int irq, void *device)return IRQ_HANDLED ; } +#define RCV_BUFFER_SIZE (16 * 1024) +static void remove_card (struct pci_dev *dev) {
@@ -517,16 +519,14 @@ remove_card(struct pci_dev *dev) lynx->rcv_start_pcl, lynx->rcv_start_pcl_bus);dma_free_coherent (&lynx->pci_device->dev,sizeof (struct pcl ), lynx->rcv_pcl, lynx->rcv_pcl_bus); -dma_free_coherent (&lynx->pci_device->dev,PAGE_SIZE , lynx->rcv_buffer, - lynx->rcv_buffer_bus); +dma_free_coherent (&lynx->pci_device->dev,RCV_BUFFER_SIZE , + lynx->rcv_buffer, lynx->rcv_buffer_bus);iounmap (lynx->registers);pci_disable_device (dev);lynx_put (lynx); } -#define RCV_BUFFER_SIZE (16 * 1024) -static int add_card (struct pci_dev *dev,const struct pci_device_id *unused) {
@@ -680,7 +680,7 @@ add_card(struct pci_dev *dev, const struct pci_device_id *unused)dma_free_coherent (&lynx->pci_device->dev,sizeof (struct pcl ), lynx->rcv_pcl, lynx->rcv_pcl_bus);if (lynx->rcv_buffer) -dma_free_coherent (&lynx->pci_device->dev,PAGE_SIZE , +dma_free_coherent (&lynx->pci_device->dev,RCV_BUFFER_SIZE , lynx->rcv_buffer, lynx->rcv_buffer_bus);iounmap (lynx->registers);
Signature · 1 line
2.43.0
Le 16/12/2025 à 17:54, Thomas Fourier a écrit :
Quoted 5 lines
It looks like the buffer allocated and mapped in
add_card()is done with sizeRCV_BUFFER_SIZEwhich is 16 KB and 4KB.Fixes 286468210d83 ("firewire: new driver: nosy - IEEE 1394 traffic sniffer")Signed-off-by Thomas Fourier <[email protected]>
And for the records, see [1].
CJ
[1]: https://lore.kernel.org/lkml/[email protected]/
drivers/firewire/nosy.c irq_handler(int irq, void *device) · line 497
Quoted 13 lines
--- drivers/firewire/nosy.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/firewire/nosy.c +1
-0@@ -494,6 +494,8 @@ irq_handler(int irq, void *device)return IRQ_HANDLED ; } +#define RCV_BUFFER_SIZE (16 * 1024)
Maybe this could be moved at the top of the file when #define are usually placed.
Quoted 32 lines
drivers/firewire/nosy.c +4
-5+static void remove_card (struct pci_dev *dev) {@@ -517,16 +519,14 @@ remove_card(struct pci_dev *dev) lynx->rcv_start_pcl, lynx->rcv_start_pcl_bus);dma_free_coherent (&lynx->pci_device->dev,sizeof (struct pcl ), lynx->rcv_pcl, lynx->rcv_pcl_bus); -dma_free_coherent (&lynx->pci_device->dev,PAGE_SIZE , lynx->rcv_buffer, - lynx->rcv_buffer_bus); +dma_free_coherent (&lynx->pci_device->dev,RCV_BUFFER_SIZE , + lynx->rcv_buffer, lynx->rcv_buffer_bus);iounmap (lynx->registers);pci_disable_device (dev);lynx_put (lynx); } -#define RCV_BUFFER_SIZE (16 * 1024) -static int add_card (struct pci_dev *dev,const struct pci_device_id *unused) {@@ -680,7 +680,7 @@ add_card(struct pci_dev *dev, const struct pci_device_id *unused)dma_free_coherent (&lynx->pci_device->dev,sizeof (struct pcl ), lynx->rcv_pcl, lynx->rcv_pcl_bus);if (lynx->rcv_buffer) -dma_free_coherent (&lynx->pci_device->dev,PAGE_SIZE , +dma_free_coherent (&lynx->pci_device->dev,RCV_BUFFER_SIZE , lynx->rcv_buffer, lynx->rcv_buffer_bus);iounmap (lynx->registers);
Takashi Sakamoto
maintainerHi,
I'm sorry to be late for reply, but I'm in travel and could not process the reviewed patches for my tree. Please wait for the next weekend.
It's our misfortune that Christophe's first proposal has been overlooked. (The patch was posted before 2023, when I took over the role...) Let us put it for next merge window to v6.20 kernel.
Quoted 51 lines · Christophe JAILLET
Le 16/12/2025 à 17:54, Thomas Fourier a écrit :
Quoted 5 lines
It looks like the buffer allocated and mapped in
add_card()is done with sizeRCV_BUFFER_SIZEwhich is 16 KB and 4KB.Fixes 286468210d83 ("firewire: new driver: nosy - IEEE 1394 traffic sniffer")Signed-off-by Thomas Fourier <[email protected]>Reviewed-by Christophe JAILLET <[email protected]>And for the records, see [1].
CJ
[1]:
https://lore.kernel.org/lkml/[email protected]/drivers/firewire/nosy.c irq_handler(int irq, void *device) · line 497
Quoted 13 lines
--- drivers/firewire/nosy.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/firewire/nosy.c +1
-0@@ -494,6 +494,8 @@ irq_handler(int irq, void *device)return IRQ_HANDLED ; } +#define RCV_BUFFER_SIZE (16 * 1024)Maybe this could be moved at the top of the file when #define are usually placed.
Quoted 18 lines
drivers/firewire/nosy.c +3
-2+static void remove_card (struct pci_dev *dev) {@@ -517,16 +519,14 @@ remove_card(struct pci_dev *dev) lynx->rcv_start_pcl, lynx->rcv_start_pcl_bus);dma_free_coherent (&lynx->pci_device->dev,sizeof (struct pcl ), lynx->rcv_pcl, lynx->rcv_pcl_bus); -dma_free_coherent (&lynx->pci_device->dev,PAGE_SIZE , lynx->rcv_buffer, - lynx->rcv_buffer_bus); +dma_free_coherent (&lynx->pci_device->dev,RCV_BUFFER_SIZE , + lynx->rcv_buffer, lynx->rcv_buffer_bus);iounmap (lynx->registers);pci_disable_device (dev);lynx_put (lynx); }
Quoted 13 lines
drivers/firewire/nosy.c add_card(struct pci_dev *dev, const struct pci_device_id *unused) · line 685
Quoted 13 lines
drivers/firewire/nosy.c +1
-3-#define RCV_BUFFER_SIZE (16 * 1024) -static int add_card (struct pci_dev *dev,const struct pci_device_id *unused) {@@ -680,7 +680,7 @@ add_card(struct pci_dev *dev, const struct pci_device_id *unused)dma_free_coherent (&lynx->pci_device->dev,sizeof (struct pcl ), lynx->rcv_pcl, lynx->rcv_pcl_bus);if (lynx->rcv_buffer) -dma_free_coherent (&lynx->pci_device->dev,PAGE_SIZE , +dma_free_coherent (&lynx->pci_device->dev,RCV_BUFFER_SIZE , lynx->rcv_buffer, lynx->rcv_buffer_bus);iounmap (lynx->registers);
Cheers
Takashi Sakamoto
Hi,
Quoted 7 lines · Christophe JAILLET
Le 16/12/2025 à 17:54, Thomas Fourier a écrit :
Quoted 5 lines
It looks like the buffer allocated and mapped in
add_card()is done with sizeRCV_BUFFER_SIZEwhich is 16 KB and 4KB.Fixes 286468210d83 ("firewire: new driver: nosy - IEEE 1394 traffic sniffer")Signed-off-by Thomas Fourier <[email protected]>
Quoted 11 lines
Reviewed-by Christophe JAILLET <[email protected]>And for the records, see [1].
CJ
[1]: https://lore.kernel.org/lkml/[email protected]/
Quoted 3 lines
--- drivers/firewire/nosy.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
Applied to for-linus branch[1], with my handy modification for the place of the macro, using 'Co-developed-by' tags with all of you. I'll send it to mainline in this weekend so that it will be included in v6.19-rc3.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394.git/log/?h=for-linus
Thanks
Takashi Sakamoto