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]
Date:   Sat, 4 Feb 2017 11:33:04 +0800
From:   zhouxianrong <zhouxianrong@...wei.com>
To:     Matthew Wilcox <willy@...radead.org>
CC:     <linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
        <akpm@...ux-foundation.org>, <sergey.senozhatsky@...il.com>,
        <minchan@...nel.org>, <iamjoonsoo.kim@....com>,
        <ngupta@...are.org>, <Mi.Sophia.Wang@...wei.com>,
        <zhouxiyu@...wei.com>, <weidu.du@...wei.com>,
        <zhangshiming5@...wei.com>, <won.ho.park@...wei.com>
Subject: Re: [PATCH] mm: extend zero pages to same element pages for zram

right, thanks.

On 2017/2/3 23:33, Matthew Wilcox wrote:
> On Fri, Feb 03, 2017 at 04:42:27PM +0800, zhouxianrong@...wei.com wrote:
>> +static inline void zram_fill_page_partial(char *ptr, unsigned int size,
>> +		unsigned long value)
>> +{
>> +	int i;
>> +	unsigned long *page;
>> +
>> +	if (likely(value == 0)) {
>> +		memset(ptr, 0, size);
>> +		return;
>> +	}
>> +
>> +	i = ((unsigned long)ptr) % sizeof(*page);
>> +	if (i) {
>> +		while (i < sizeof(*page)) {
>> +			*ptr++ = (value >> (i * 8)) & 0xff;
>> +			--size;
>> +			++i;
>> +		}
>> +	}
>> +
>> +	for (i = size / sizeof(*page); i > 0; --i) {
>> +		page = (unsigned long *)ptr;
>> +		*page = value;
>> +		ptr += sizeof(*page);
>> +		size -= sizeof(*page);
>> +	}
>> +
>> +	for (i = 0; i < size; ++i)
>> +		*ptr++ = (value >> (i * 8)) & 0xff;
>> +}
>
> You're assuming little-endian here.  I think you need to do a
> cpu_to_le() here, but I don't think we have a cpu_to_leul, only
> cpu_to_le64/cpu_to_le32.  So you may have some work to do ...
>
>
> .
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ