From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.smtpout.orange.fr (smtp-80.smtpout.orange.fr [80.12.242.80]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 978DF1FDA8E for ; Tue, 16 Dec 2025 17:47:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.12.242.80 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765907266; cv=none; b=XE84A7WSvaMmJtX9El/HTpE8/rr3pyAYK9pR4DyinKHzyT+q4+jRcgQkli3xbSAWJ+bidrPc5qdxy0QDn2GwtwTByIr3nnQTxF3q2jvTwxEHWbPRc1ZBYncKx95sgMNb8VXYAhft8R5yLEEwV4qCpJw+RNcUIwy40Ac1mgjMBEM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765907266; c=relaxed/simple; bh=Y0M5HlUAS36q7Rl/pEmWgEoPBmgPP3O8AIb3LwEiwKU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=m7dw48zgWeO9Eokw0/bKKrGFdbYFkvrSS3BmYbLOjRRY8PBVnOVifasxwuzheaYUzyxylbMQgfVJFr0X9zdVtKhztNAzPtyMS/PgZoPhI8itwQY709jrBboAp4qrxxHut3M7ZhrSZPIElfItj5q8ZqKZtcJ6hHdq+r/sEoiJpzI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=wanadoo.fr; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b=lm745ddd; arc=none smtp.client-ip=80.12.242.80 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="lm745ddd" Received: from [IPV6:2a01:cb10:785:b00:8347:f260:7456:7662] ([IPv6:2a01:cb10:785:b00:8347:f260:7456:7662]) by smtp.orange.fr with ESMTPA id VZ90vbpz53uKaVZ90vDx64; Tue, 16 Dec 2025 18:47:32 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1765907252; bh=csUbuungvHo+Ae/XRYDcfFq1SyrsZAIKu5p4KCJqZMU=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=lm745dddATyYsRIhjkR5jx7U+ANQ/7ssVczbrQb0EVA3udL9YxFXobD+tuOJC5NIi hkteQhlK5mL+sC7upbFM0ZYFnbG2xuEtrvxJ9/jP4A33YNfute2MxJUQXrAF8BbE55 7sukBz4ymC9d+q6nECpHoRa0cD8sV/Auc9RFTqK9sXwFbAE9wWxS2y5B3wpm9G6QBG fXqwd9dPTMbd9G0UuILkAYvlHcOw96e4wFGYaCvB0ktBGiVp8sbp49WINZVCh+7tkC 6ypKKFjKSajv6a0AAOkIGJPf0cdkGGSpKOuCrY+1Y+nzKikq5yY2kn/fVTHPDSA423 6i3xau6bngGkw== X-ME-Helo: [IPV6:2a01:cb10:785:b00:8347:f260:7456:7662] X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 16 Dec 2025 18:47:32 +0100 X-ME-IP: 2a01:cb10:785:b00:8347:f260:7456:7662 Message-ID: <7ffdcfff-0f2f-4563-9051-d398f3c5c6a7@wanadoo.fr> Date: Tue, 16 Dec 2025 18:47:30 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] firewire: nosy: Fix dma_free_coherent() size To: Thomas Fourier Cc: Takashi Sakamoto , =?UTF-8?Q?Kristian_H=C3=B8gsberg?= , Stefan Richter , linux1394-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org References: <20251216165420.38355-2-fourier.thomas@gmail.com> Content-Language: en-US, fr-FR From: Christophe JAILLET In-Reply-To: <20251216165420.38355-2-fourier.thomas@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Le 16/12/2025 à 17:54, Thomas Fourier a écrit : > 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: 286468210d83 ("firewire: new driver: nosy - IEEE 1394 traffic sniffer") > Signed-off-by: Thomas Fourier Reviewed-by: Christophe JAILLET And for the records, see [1]. CJ [1]: https://lore.kernel.org/lkml/20200625191554.941614-1-christophe.jaillet@wanadoo.fr/ > --- > drivers/firewire/nosy.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/firewire/nosy.c b/drivers/firewire/nosy.c > index ea31ac7ac1ca..f562e82e5438 100644 > --- a/drivers/firewire/nosy.c > +++ b/drivers/firewire/nosy.c > @@ -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. > + > 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); >