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: <b87ff5e2-156f-4bf8-9001-9cfbb79871ae@linux.dev>
Date:   Wed, 8 Nov 2023 06:16:52 +0300
From:   Vasily Averin <vasily.averin@...ux.dev>
To:     Sergey Senozhatsky <senozhatsky@...omium.org>
Cc:     Minchan Kim <minchan@...nel.org>, linux-kernel@...r.kernel.org,
        linux-block@...r.kernel.org, zhouxianrong <zhouxianrong@...wei.com>
Subject: Re: [PATCH] zram: extra zram_get_element call in
 zram_read_from_zspool()

On 11/8/23 05:49, Sergey Senozhatsky wrote:
> On (23/11/06 22:55), Vasily Averin wrote:
>>
>> 'element' and 'handle' are union in struct zram_table_entry.
>>
>> Fixes: 8e19d540d107 ("zram: extend zero pages to same element pages")
> 
> Sorry, what exactly does it fix?

It removes unneeded call of zram_get_element() and unneeded variable 'value'.
zram_get_element() == zram_get_handle(), they both access the same field of the same struct zram_table_entry,
no need to read it 2nd time. 
'value' variable is not required, 'handle' can be used instead.

I hope this explain why element/handle union should be removed: it confuses reviewers.

> [..]
>> @@ -1318,12 +1318,10 @@ static int zram_read_from_zspool(struct zram *zram, struct page *page,
>>  
>>  	handle = zram_get_handle(zram, index);
>>  	if (!handle || zram_test_flag(zram, index, ZRAM_SAME)) {
>> -		unsigned long value;
>>  		void *mem;
>>  
>> -		value = handle ? zram_get_element(zram, index) : 0;
>>  		mem = kmap_atomic(page);
>> -		zram_fill_page(mem, PAGE_SIZE, value);
>> +		zram_fill_page(mem, PAGE_SIZE, handle);
>>  		kunmap_atomic(mem);
>>  		return 0;
>>  	}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ