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] [thread-next>] [day] [month] [year] [list]
Message-ID: <9fedf186-0522-d40f-3d8d-88d0462da0b1@gmail.com>
Date:   Fri, 8 Feb 2019 18:44:17 +0300
From:   Dmitry Osipenko <digetx@...il.com>
To:     Sowjanya Komatineni <skomatineni@...dia.com>,
        Peter Rosin <peda@...ntia.se>,
        "thierry.reding@...il.com" <thierry.reding@...il.com>,
        Jonathan Hunter <jonathanh@...dia.com>,
        Mantravadi Karthik <mkarthik@...dia.com>,
        Shardar Mohammed <smohammed@...dia.com>,
        Timo Alho <talho@...dia.com>
Cc:     "linux-tegra@...r.kernel.org" <linux-tegra@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-i2c@...r.kernel.org" <linux-i2c@...r.kernel.org>
Subject: Re: [PATCH V15 3/6] i2c: tegra: fix maximum transfer size

08.02.2019 18:25, Sowjanya Komatineni пишет:
>> 08.02.2019 17:12, Peter Rosin пишет:
>>> On 2019-02-08 13:46, Dmitry Osipenko wrote:
>>>> 08.02.2019 1:25, Dmitry Osipenko пишет:
>>>>>> 08.02.2019 1:16, Sowjanya Komatineni пишет:>
>>>>>>>> This is wrong, 65535 = 64 * 1024 - 1.
>>>>>>>>
>>>>>>>> Let's just use size-constants provided by kernel:
>>>>>>>>
>>>>>>>> static const struct i2c_adapter_quirks tegra_i2c_quirks = {
>>>>>>>> 	.flags = I2C_AQ_NO_ZERO_LEN,
>>>>>>>> 	.max_read_len = SZ_4K,
>>>>>>>> 	.max_write_len = SZ_4K - I2C_PACKET_HEADER_SIZE, };
>>>>>>>>
>>>>>>>> static const struct i2c_adapter_quirks tegra194_i2c_quirks = {
>>>>>>>> 	.flags = I2C_AQ_NO_ZERO_LEN,
>>>>>>>> 	.max_read_len = SZ_64K,
>>>>>>>> 	.max_write_len = SZ_64K - I2C_PACKET_HEADER_SIZE, };
>>>>>>>>
>>>>>>>>
>>>>>>>> I'll take a look at other patches later today, no need to send out new version right now.
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> SIZE_64K is 0x00010000 (65536)
>>>>>>>
>>>>>>> msg len is u16 and max that can be set to msg.len is 65535
>>>>>
>>>>> Ah, okay. Then it looks about right, maybe it's time to change u16 to u32 in the I2C core.
>>>>>
>>>>
>>>> Here is my suggestion:
>>>>
>>>> 1) Use SZ_4K / SZ_64K that I suggested above.
>>>>
>>>> 2) Squash this patch into the DMA-patch.
>>>>
>>>> 3) Add another patch (before the DMA-patch) that changes 
>>>> max_read_len/max_write_len types to u32 in the include/linux/i2c.h
>>>
>>> That is a bit naive and will not fly since the I2C core has a max 
>>> message size of 65535. Which is exposed to user space...
>>>
>>> Given the above, saying .max_read_len = 65535 a NOP (and is in fact 
>>> omitted in places where it would be needed if the type is changed). I 
>>> suggest that it is omitted here as well. But SZ_64K - 
>>> I2C_PACKET_HEADER_SIZE is still needed of course. At least if 
>>> I2C_PACKET_HEADER_SIZE is guaranteed to be non-zero?
>>
>> Ah, I missed that message len is also u16 and then we indeed could just drop the "max_read_len" for T194. Thank you Peter.
>>
>> Sowjanya, given the above, it probably better to define dma_buf max-size in the tegra_i2c_hw_feature.
>>
> 
> I2C_PACKET_HEADER_SIZE is always fixed 12. So in that case, we can just add max_write_len 
> If no max_read_len, max will be 65535 anyway right
> 
> static const struct i2c_adapter_quirks tegra194_i2c_quirks = {
> 	.flags = I2C_AQ_NO_ZERO_LEN,
> 	.max_write_len = SZ_64K - I2C_PACKET_HEADER_SIZE, };

Yes, adding header size to the max_write_len for the dma_buf size also will be fine.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ