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-next>] [day] [month] [year] [list]
Message-ID: <Z1vf/ladGMjeGpfi@HOME-PC>
Date: Fri, 13 Dec 2024 12:49:26 +0530
From: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@...il.com>
To: minchan@...nel.org, senozhatsky@...omium.org
Cc: axboe@...nel.dk, linux-kernel@...r.kernel.org,
	linux-block@...r.kernel.org
Subject: Clarification on last_comp_len logic in zram_write_page

Dear Maintainers,

I am writing to seek clarification regarding the use of last_comp_len
variable in zram_write_page function. Specifically, Coverity has flagged 
the issue (CID 1602439) in zram/zram_drv.c

Link to the coverity issue:
https://scan7.scan.coverity.com/#/project-view/52337/11354?selectedIssue=1602439

Currently, last_comp_len is initialized to 0 but never updated within the
function. This renders the conditional block shown below as dead code.

	if (last_comp_len && (last_comp_len != comp_len)) {
    		zs_free(zram->mem_pool, handle);
    		handle = -ENOMEM;
	}

>From the context, it appears that this variable might be intended to track the
compression length from a previous iteration for comparison purposes.

I would like to confirm the intended behavior here:

	1. Should last_comp_len be updated to comp_len after every compression
	 iteration to enable this comparison?

	2. Is this logic necessary for scenarios where compression lengths
	differ between iterations, or can this block be removed altogether?

To address this, I propose a fix where last_comp_len is updated after the
conditional block as shown below, ensuring it reflects the last compression
length:
	if (last_comp_len && (last_comp_len != comp_len)) {
    		zs_free(zram->mem_pool, handle);
    		andle = -ENOMEM;
	}
	last_comp_len = comp_len;

Could you please clarify whether this approach aligns with the intended
functionality of the code?

Thank you for your time and assistance.

-Dheeraj

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ