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: <4eef2944-9ce7-4126-bf09-3e4afcc52dbf@web.de>
Date: Wed, 18 Sep 2024 11:38:57 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: Jani Nikula <jani.nikula@...el.com>, intel-xe@...ts.freedesktop.org,
 dri-devel@...ts.freedesktop.org, kernel-janitors@...r.kernel.org,
 Daniel Vetter <daniel.vetter@...ll.ch>, David Airlie <airlied@...il.com>,
 Faith Ekstrand <faith.ekstrand@...labora.com>,
 Francois Dugast <francois.dugast@...el.com>,
 José Roberto de Souza <jose.souza@...el.com>,
 Lucas De Marchi <lucas.demarchi@...el.com>,
 Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
 Matt Roper <matthew.d.roper@...el.com>,
 Matthew Brost <matthew.brost@...el.com>,
 Mauro Carvalho Chehab <mchehab@...nel.org>,
 Maxime Ripard <mripard@...nel.org>, Nirmoy Das <nirmoy.das@...el.com>,
 Philippe Lecluse <philippe.lecluse@...el.com>,
 Rodrigo Vivi <rodrigo.vivi@...el.com>, Simona Vetter <simona@...ll.ch>,
 Thomas Hellström <thomas.hellstrom@...ux.intel.com>,
 Thomas Zimmermann <tzimmermann@...e.de>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] drm/xe/query: Refactor copy_to_user() usage in four
 functions

>> Assign return values from copy_to_user() calls to additional local variables
>> so that four kfree() calls and return statements can be omitted accordingly.
…
>> +++ b/drivers/gpu/drm/xe/xe_query.c
>> @@ -220,13 +220,11 @@ static int query_engines(struct xe_device *xe,
>>
>>  	engines->num_engines = i;
>>
>> -	if (copy_to_user(query_ptr, engines, size)) {
>> +	{
>
> Please don't leave blocks like this behind when you remove the if.
…
>> +		unsigned long ctu = copy_to_user(query_ptr, engines, size);
>>  		kfree(engines);
>> -		return -EFAULT;
>> +		return ctu ? -EFAULT : 0;
>>  	}
>> -	kfree(engines);
>> -
>> -	return 0;
>>  }
…

Would you tolerate the shown variable definition without the proposed
compound statement?

Regards,
Markus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ