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]
Message-ID: <cd240d42-a529-428b-ab99-982a29799820@imgtec.com>
Date: Thu, 22 Aug 2024 11:41:56 +0000
From: Matt Coster <Matt.Coster@...tec.com>
To: Chen Yufan <chenyufan@...o.com>,
        "dri-devel@...ts.freedesktop.org"
	<dri-devel@...ts.freedesktop.org>,
        "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>
CC: Frank Binns <Frank.Binns@...tec.com>,
        "opensource.kernel@...o.com"
	<opensource.kernel@...o.com>
Subject: Re: [PATCH v1] ImgTec powerVR DRM driver: Convert to use time_before
 macro

Hi Chen,

Thanks for the patch! Just a couple minor notes.

On 21/08/2024 10:21, Chen Yufan wrote:

> Subject: [PATCH v1] ImgTec powerVR DRM driver: Convert to use time_before macro

The prefix here should be based on the source path. For us, that's 
"drm/imagination:".

> Use time_before instead of direct subtraction for readability.

I think the real justification here is correctness. The code as it
currently exists is susceptible to overflow issues that are handled
correctly by the time_*() macros.

> Signed-off-by: Chen Yufan <chenyufan@...o.com>

Please add a Fixes: tag as per [1].

> ---
>   drivers/gpu/drm/imagination/pvr_ccb.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/imagination/pvr_ccb.c b/drivers/gpu/drm/imagination/pvr_ccb.c
> index 4deeac7ed..b7d5f9ca3 100644
> --- a/drivers/gpu/drm/imagination/pvr_ccb.c
> +++ b/drivers/gpu/drm/imagination/pvr_ccb.c
> @@ -321,7 +321,7 @@ static int pvr_kccb_reserve_slot_sync(struct pvr_device *pvr_dev)
>   	bool reserved = false;
>   	u32 retries = 0;
>   
> -	while ((jiffies - start_timestamp) < (u32)RESERVE_SLOT_TIMEOUT ||
> +	while (time_before(jiffies, start_timestamp + (u32)RESERVE_SLOT_TIMEOUT) ||

You might as well drop the cast here too; it only seems to have existed here
as an attempt to correclty deal with overflow.

Cheers,
Matt

[1]: 
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes

>   	       retries < RESERVE_SLOT_MIN_RETRIES) {
>   		reserved = pvr_kccb_try_reserve_slot(pvr_dev);
>   		if (reserved)

Download attachment "OpenPGP_signature.asc" of type "application/pgp-signature" (237 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ