lists.openwall.net   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  linux-cve-announce  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]
Message-ID: <20241009100450.362e3556@xps-13>
Date: Wed, 9 Oct 2024 10:04:50 +0200
From: Miquel Raynal <miquel.raynal@...tlin.com>
To: Hui-Ping Chen <hpchen0nvt@...il.com>
Cc: richard@....at, vigneshr@...com, robh@...nel.org, krzk+dt@...nel.org,
 conor+dt@...nel.org, nikita.shubin@...uefel.me, arnd@...db.de,
 vkoul@...nel.org, esben@...nix.com, linux-arm-kernel@...ts.infradead.org,
 linux-mtd@...ts.infradead.org, devicetree@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH v6 2/2] mtd: rawnand: nuvoton: add new driver for the
 Nuvoton MA35 SoC

Hi Hui-Ping,

> >>>> +		return 0;
> >>>> +	}
> >>>> +
> >>>> +	ma35_nand_dmac_init(nand);
> >>>> +
> >>>> +	writel(mtd->oobsize, nand->regs + MA35_NFI_REG_NANDRACTL);
> >>>> +
> >>>> +	/* setup and start DMA using dma_addr */
> >>>> +	dma_addr = dma_map_single(nand->dev, (void *)addr, len, DMA_FROM_DEVICE);
> >>>> +	ret = dma_mapping_error(nand->dev, dma_addr);
> >>>> +	if (ret) {
> >>>> +		dev_err(nand->dev, "dma mapping error\n");
> >>>> +		return -EINVAL;
> >>>> +	}
> >>>> +
> >>>> +	writel((unsigned long)dma_addr, nand->regs + MA35_NFI_REG_DMASA);  
> >>> Please enforce a dma mask of 32 (even though it might be the fault).  
> >> I will change it to dma_addr & 0xffffffff.  
> > That's not what I mean, I believe you should use the dma API to ask for
> > a mapping within the accessible 32-bit address range. The
> > dma_mapping_error() check should return an error if that's not the
> > case. Then you can safely write the value.  
> 
> Here is my misunderstanding: just fill in the dma_addr directly,
> 
> no type conversion is needed. I have already tested it.

FYI, it only works because the default DMA mask for your device is gonna
be 32 bits. If the reality (what your peripheral DMA can do) was
different than this, you would have to set a different mask explicitly
to make sure the dma-mapping step would not provide buffers which are
out of reach.

Thanks,
Miquèl

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ