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: <20240812154610.GC21855@kernel.org>
Date: Mon, 12 Aug 2024 16:46:10 +0100
From: Simon Horman <horms@...nel.org>
To: Abhinav Jain <jain.abhinav177@...il.com>
Cc: idryomov@...il.com, xiubli@...hat.com, davem@...emloft.net,
	edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
	ceph-devel@...r.kernel.org, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org, skhan@...uxfoundation.org,
	javier.carrasco.cruz@...il.com
Subject: Re: [PATCH net v2] libceph: Make the arguments const as per the TODO

On Mon, Aug 12, 2024 at 02:25:09AM +0530, Abhinav Jain wrote:
> net/ceph/crypto.c:
> Modify arguments to const in ceph_crypto_key_decode().
> Modify ceph_key_preparse() and ceph_crypto_key_unarmor()
> in accordance with the changes.
> 
> net/ceph/crypto.h:
> Add changes in the prototype of ceph_crypto_key_decode().
> 
> net/ceph/auth_x.c:
> Modify the arguments to function ceph_crypto_key_decode()
> being called in the function process_one_ticket().

Hi,

I think that the subject and patch description need to be reworked.
We can see easily enough from the code what is being done.
But why?

> 
> v1:
> lore.kernel.org/all/20240811193645.1082042-1-jain.abhinav177@...il.com
> 
> Changes since v1:
>  - Incorrect changes made in v1 fixed.
>  - Found the other files where the change needed to be made.
> 
> Signed-off-by: Abhinav Jain <jain.abhinav177@...il.com>

Please take some time before posting the next revision of this patch.

Please do run checkpatch.pl --strict --codespell
and, within reason, correct the issues it flags.

Please make sure that allmodconfig builds compile.
At least on x86_64.

...

> diff --git a/net/ceph/crypto.c b/net/ceph/crypto.c

...

> @@ -123,7 +124,7 @@ int ceph_crypto_key_unarmor(struct ceph_crypto_key *key, const char *inkey)
>  	}
>  
>  	p = buf;
> -	ret = ceph_crypto_key_decode(key, &p, p + blen);
> +	ret = ceph_crypto_key_decode(key, &p, (const void *)((const char *)p + blen));

It is usually not necessary to implicitly cast a pointer to (void *).
Also, while it mat address a compiler warning, it's not claear to me how
this is related to the const change that is the subject of this patch.

>  	kfree(buf);
>  	if (ret)
>  		return ret;

...

> @@ -311,9 +312,9 @@ static int ceph_key_preparse(struct key_preparsed_payload *prep)
>  	if (!ckey)
>  		goto err;
>  
> -	/* TODO ceph_crypto_key_decode should really take const input */
> -	p = (void *)prep->data;
> -	ret = ceph_crypto_key_decode(ckey, &p, (char*)prep->data+datalen);
> +	p = prep->data;
> +	ret = ceph_crypto_key_decode(ckey, &p, \
> +			(const void *)((const char *)prep->data + datalen));

I don't think you need the cast to void * here either.

>  	if (ret < 0)
>  		goto err_ckey;
>  

...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ