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: <d840d693-b23d-46e2-8996-b59b5e556cf6@oss.qualcomm.com>
Date: Mon, 5 Jan 2026 09:48:53 +1100
From: Amirreza Zarrabi <amirreza.zarrabi@....qualcomm.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@....qualcomm.com>,
        Jens Wiklander <jens.wiklander@...aro.org>,
        Sumit Garg <sumit.garg@...nel.org>, linux-arm-msm@...r.kernel.org,
        op-tee@...ts.trustedfirmware.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] tee: qcomtee: mem: Fix confusing cleanup.h syntax


On 12/8/2025 1:08 PM, Krzysztof Kozlowski wrote:
> Initializing automatic __free variables to NULL without need (e.g.
> branches with different allocations), followed by actual allocation is
> in contrary to explicit coding rules guiding cleanup.h:
> 
> "Given that the "__free(...) = NULL" pattern for variables defined at
> the top of the function poses this potential interdependency problem the
> recommendation is to always define and assign variables in one statement
> and not group variable definitions at the top of the function when
> __free() is used."
> 
> Code does not have a bug, but is less readable and uses discouraged
> coding practice, so fix that by moving declaration to the place of
> assignment.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@....qualcomm.com>
> ---
>  drivers/tee/qcomtee/mem_obj.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tee/qcomtee/mem_obj.c b/drivers/tee/qcomtee/mem_obj.c
> index 228a3e30a31b..a16f8fc39b8d 100644
> --- a/drivers/tee/qcomtee/mem_obj.c
> +++ b/drivers/tee/qcomtee/mem_obj.c
> @@ -88,11 +88,11 @@ int qcomtee_memobj_param_to_object(struct qcomtee_object **object,
>  				   struct tee_param *param,
>  				   struct tee_context *ctx)
>  {
> -	struct qcomtee_mem_object *mem_object __free(kfree) = NULL;
>  	struct tee_shm *shm;
>  	int err;
>  
> -	mem_object = kzalloc(sizeof(*mem_object), GFP_KERNEL);
> +	struct qcomtee_mem_object *mem_object __free(kfree) = kzalloc(sizeof(*mem_object),
> +								      GFP_KERNEL);
>  	if (!mem_object)
>  		return -ENOMEM;
>  

Reviewed-by: Amirreza Zarrabi <amirreza.zarrabi@....qualcomm.com>

- Amir


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ