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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a7096e0c-7132-5511-2fe0-1172caec5a7f@gmail.com>
Date:   Wed, 27 Sep 2023 15:32:15 +0300
From:   Matti Vaittinen <mazziesaccount@...il.com>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     Matti Vaittinen <matti.vaittinen@...rohmeurope.com>,
        Jonathan Cameron <jic23@...nel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Conor Dooley <conor+dt@...nel.org>,
        Angel Iglesias <ang.iglesiasg@...il.com>,
        Andreas Klinger <ak@...klinger.de>,
        Benjamin Bara <bbara93@...il.com>,
        Christophe JAILLET <christophe.jaillet@...adoo.fr>,
        linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 1/5] tools: iio: iio_generic_buffer ensure alignment

On 9/27/23 15:27, Andy Shevchenko wrote:
> On Wed, Sep 27, 2023 at 11:26:07AM +0300, Matti Vaittinen wrote:
>> The iio_generic_buffer can return garbage values when the total size of
>> scan data is not a multiple of the largest element in the scan. This can be
>> demonstrated by reading a scan, consisting, for example of one 4-byte and
>> one 2-byte element, where the 4-byte element is first in the buffer.
>>
>> The IIO generic buffer code does not take into account the last two
>> padding bytes that are needed to ensure that the 4-byte data for next
>> scan is correctly aligned.
>>
>> Add the padding bytes required to align the next sample with the scan size.
> 
> ...
> 
>> +	/*
>> +	 * We wan't the data in next sample to also be properly aligned so
> 
> Pardon me, won't or want, I didn't get?..

Both :D Well, purpose was to say want, but as I try to explain we get 
what we want only in some case - in other cases we won't ;) Anyways, 
this is something that should be fixed - thanks :)

> 
>> +	 * we'll add padding at the end if needed.
>> +	 *
>> +	 * Please note, this code does ensure alignment to maximum channel
>> +	 * size. It works only as long as the channel sizes are 1, 2, 4 or 8
>> +	 * bytes. Also, on 32 bit platforms it might be enough to align also
> 
> 32-bit
> 
>> +	 * the 8 byte elements to 4 byte boundary - which this code is not
> 
> 8-byte
> 4-byte
> 
>> +	 * doing.
>> +	 */
> 

Thanks!

Yours,
	-- Matti

-- 
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ