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: <ba4e4376-7d75-4b0e-9d59-26e32dbe2029@milecki.pl>
Date:   Fri, 5 Mar 2021 11:39:36 +0100
From:   Rafał Miłecki <rafal@...ecki.pl>
To:     Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
        Rafał Miłecki <zajec5@...il.com>,
        Rob Herring <robh+dt@...nel.org>
Cc:     devicetree@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-mips@...r.kernel.org,
        Florian Fainelli <f.fainelli@...il.com>,
        Vivek Unune <npcomplete13@...il.com>,
        bcm-kernel-feedback-list@...adcom.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] nvmem: iomap: new driver exposing NVMEM accessible
 using I/O mapping

On 05.03.2021 11:33, Srinivas Kandagatla wrote:
> On 05/03/2021 10:24, Rafał Miłecki wrote:
>>>>
>>>> +static int iomap_read(void *context, unsigned int offset, void *val,
>>>> +              size_t bytes)
>>>> +{
>>>> +    struct iomap *priv = context;
>>>> +    u8 *src = priv->base + offset;
>>>> +    u8 *dst = val;
>>>> +    size_t tmp;
>>>> +
>>>> +    tmp = offset % 4;
>>>> +    memcpy_fromio(dst, src, tmp);
>>>> +    dst += tmp;
>>>> +    src += tmp;
>>>> +    bytes -= tmp;
>>>> +
>>>> +    tmp = rounddown(bytes, 4);
>>>> +    __ioread32_copy(dst, src, tmp / 4);
>>>> +    dst += tmp;
>>>> +    src += tmp;
>>>> +    bytes -= tmp;
>>>> +
>>>> +    memcpy_fromio(dst, src, bytes);
>>>> +
>>>
>>>
>>> You could just do this!
>>>
>>>      while (bytes--)
>>>          *val++ = readb(priv->base + offset + i++);
>>
>> Do you mean that as replacement for "memcpy_fromio" or the whole
>> function code?
> 
> Yes please!
> 
>> The reason for using __ioread32_copy() was to improve reading
>> performance (using aligned 32 bit access where possible). I'm not sure
>> if that really matters?
> 
> Just simple while loop is much readable than the previous code TBH!
> 
>>
> 
>> P.S.
>> Please don't yell at me in every sentence :( Makes me a bit sad :(
> Sorry!! I did not mean anything as such! :-)

All clear (I hope)! Thanks for your review!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ