lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Fri, 12 Aug 2022 09:58:14 -0700
From:   Florian Fainelli <>
To:     Andrew Lunn <>, Sergei Antonov <>
Cc:, Jakub Kicinski <>,
        Pavel Skripkin <>,
        "David S . Miller" <>,
        Guobin Huang <>,
        Paolo Abeni <>
Subject: Re: [PATCH] net: moxa: inherit DMA masks to make dma_map_single()

On 8/12/22 09:38, Andrew Lunn wrote:
> On Fri, Aug 12, 2022 at 07:35:43PM +0300, Sergei Antonov wrote:
>> On Fri, 12 Aug 2022 at 19:13, Andrew Lunn <> wrote:
>>>> +     /* Inherit the DMA masks from the platform device */
>>>> +     ndev->dev.dma_mask = p_dev->dma_mask;
>>>> +     ndev->dev.coherent_dma_mask = p_dev->coherent_dma_mask;
>>> There is only one other ethernet driver which does this. What you see
>>> much more often is:
>>> alacritech/slicoss.c:   paddr = dma_map_single(&sdev->pdev->dev, skb->data, maplen,
>>> neterion/s2io.c:                                dma_map_single(&sp->pdev->dev, ba->ba_1,
>>> dlink/dl2k.c:                       cpu_to_le64(dma_map_single(&np->pdev->dev, skb->data,
>>> micrel/ksz884x.c:               dma_buf->dma = dma_map_single(&hw_priv->pdev->dev, skb->data,
>> Also works. Do you recommend to create a v2 of the patch?
> Yes please. It makes things easier to maintain if every driver does
> the same thing.

Yes this is a common pattern to store a device reference pointing to 
&pdev->dev into your network device private structure fetched via 

Alternatively, we could sort of try to settle on a common pattern where 
we utilize &dev->parent->dev thanks to having called SET_NETDEV_DEV(), 
that might be more universal?

Powered by blists - more mailing lists