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] [day] [month] [year] [list]
Date: Fri, 15 Mar 2024 10:53:22 -0700
From: Dan Williams <dan.j.williams@...el.com>
To: Yuquan Wang <wangyuquan1236@...tium.com.cn>, <ira.weiny@...el.com>,
	<jonathan.cameron@...wei.com>, <dan.j.williams@...el.com>
CC: <linux-cxl@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<qemu-devel@...gnu.org>, <chenbaozi@...tium.com.cn>, Yuquan Wang
	<wangyuquan1236@...tium.com.cn>
Subject: Re: [PATCH 1/1] cxl/mem: Fix for the index of Clear Event Record
 Handle

Yuquan Wang wrote:
> The dev_dbg info for Clear Event Records mailbox command would report
> the handle of the next record to clear not the current one.
> 
> This was because the index 'i' had incremented before printing the
> current handle value.
> 
> This fix also adjusts the index variable name from 'i' to 'clear_cnt'
> which can be easier for developers to distinguish and understand.
> 
> Signed-off-by: Yuquan Wang <wangyuquan1236@...tium.com.cn>
> ---
>  drivers/cxl/core/mbox.c | 21 +++++++++++----------
>  1 file changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
> index 9adda4795eb7..3ca2845ae6aa 100644
> --- a/drivers/cxl/core/mbox.c
> +++ b/drivers/cxl/core/mbox.c
> @@ -881,7 +881,7 @@ static int cxl_clear_event_record(struct cxl_memdev_state *mds,
>  	struct cxl_mbox_cmd mbox_cmd;
>  	u16 cnt;
>  	int rc = 0;
> -	int i;
> +	int clear_cnt;
>  
>  	/* Payload size may limit the max handles */
>  	if (pl_size > mds->payload_size) {
> @@ -908,28 +908,29 @@ static int cxl_clear_event_record(struct cxl_memdev_state *mds,
>  	 * Clear Event Records uses u8 for the handle cnt while Get Event
>  	 * Record can return up to 0xffff records.
>  	 */
> -	i = 0;
> +	clear_cnt = 0;
>  	for (cnt = 0; cnt < total; cnt++) {
>  		struct cxl_event_record_raw *raw = &get_pl->records[cnt];
>  		struct cxl_event_generic *gen = &raw->event.generic;
>  
> -		payload->handles[i++] = gen->hdr.handle;
> +		payload->handles[clear_cnt] = gen->hdr.handle;
>  		dev_dbg(mds->cxlds.dev, "Event log '%d': Clearing %u\n", log,
> -			le16_to_cpu(payload->handles[i]));

Couldn't this patch be much smaller by just changing this to "i - 1",
because from the description the only problem is the dev_dbg()
statement, so just fix that.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ