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]
Date:	Fri, 18 Mar 2016 14:37:44 +0800
From:	Jiancheng Xue <xuejiancheng@...wei.com>
To:	Jagan Teki <jteki@...nedev.com>, <robh+dt@...nel.org>,
	<pawel.moll@....com>, <mark.rutland@....com>,
	<ijc+devicetree@...lion.org.uk>, <galak@...eaurora.org>,
	<dwmw2@...radead.org>, <computersforpeace@...il.com>,
	<zajec5@...il.com>, <boris.brezillon@...e-electrons.com>,
	<ezequiel@...guardiasur.com.ar>, <juhosg@...nwrt.org>,
	<shijie.huang@...el.com>, <mika.westerberg@...ux.intel.com>,
	<furquan@...gle.com>, <han.xu@...escale.com>,
	<fabio.estevam@...escale.com>, <manabian@...il.com>
CC:	<devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<linux-mtd@...ts.infradead.org>, <yanhaifeng@...ilicon.com>,
	<yanghongwei@...ilicon.com>, <suwenping@...ilicon.com>,
	<raojun@...ilicon.com>, <ml.yang@...ilicon.com>,
	<gaofei@...ilicon.com>, <zhangzhenxing@...ilicon.com>,
	<xuejiancheng@...ilicon.com>, Binquan Peng <pengbinquan@...wei.com>
Subject: Re: [PATCH v8] mtd: spi-nor: add hisilicon spi-nor flash controller
 driver

Hi Jagan,
	Thank you for comments. I'll modify in next version.

Regards,
Jiancheng

On 2016/3/11 16:04, Jagan Teki wrote:
> 
> 
> On Friday 11 March 2016 01:11 PM, Jiancheng Xue wrote:
>> Add hisilicon spi-nor flash controller driver
>>
>> Signed-off-by: Binquan Peng <pengbinquan@...wei.com>
>> Signed-off-by: Jiancheng Xue <xuejiancheng@...wei.com>
>> Acked-by: Rob Herring <robh@...nel.org>
>> Reviewed-by: Ezequiel Garcia <ezequiel@...guardiasur.com.ar>
>> ---
[...]
>> +static void hisi_spi_nor_write(struct spi_nor *nor, loff_t to,
>> +            size_t len, size_t *retlen, const u_char *write_buf)
>> +{
>> +    struct hifmc_priv *priv = nor->priv;
>> +    struct hifmc_host *host = priv->host;
>> +    const unsigned char *ptr = write_buf;
>> +    size_t num;
>> +
>> +    while (len > 0) {
>> +        if (to & HIFMC_DMA_MASK)
>> +            num = (HIFMC_DMA_MAX_LEN - (to & HIFMC_DMA_MASK))
>> +                >= len    ? len
>> +                : (HIFMC_DMA_MAX_LEN - (to & HIFMC_DMA_MASK));
>> +        else
>> +            num = (len >= HIFMC_DMA_MAX_LEN)
>> +                ? HIFMC_DMA_MAX_LEN : len;
> 
> Since num is the actual length bytes to read Better to rename num to actual_len for proper meaning here.
> 
>> +        memcpy(host->buffer, ptr, num);
>> +        hisi_spi_nor_dma_transfer(nor, to, host->dma_buffer, num,
>> +                FMC_OP_WRITE);
>> +        to += num;
>> +        ptr += num;
>> +        len -= num;
>> +    }
>> +    *retlen += (size_t)(ptr - write_buf);
> 
> Please avoid this type casting and do *retlen += num inside while.
> 
> -- 
> Jagan
> 
> .
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ