netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Abhinav Jain <jain.abhinav177@gmail.com>
Cc: idryomov@gmail.com, xiubli@redhat.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	ceph-devel@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, skhan@linuxfoundation.org,
	javier.carrasco.cruz@gmail.com
Subject: Re: [PATCH net v2] libceph: Make the arguments const as per the TODO
Date: Mon, 12 Aug 2024 16:46:10 +0100	[thread overview]
Message-ID: <20240812154610.GC21855@kernel.org> (raw)
In-Reply-To: <20240811205509.1089027-1-jain.abhinav177@gmail.com>

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@gmail.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@gmail.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;
>  

...

      parent reply	other threads:[~2024-08-12 15:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-11 20:55 [PATCH net v2] libceph: Make the arguments const as per the TODO Abhinav Jain
2024-08-12  7:09 ` kernel test robot
2024-08-12 15:26 ` kernel test robot
2024-08-12 15:46 ` Simon Horman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240812154610.GC21855@kernel.org \
    --to=horms@kernel.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=idryomov@gmail.com \
    --cc=jain.abhinav177@gmail.com \
    --cc=javier.carrasco.cruz@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=skhan@linuxfoundation.org \
    --cc=xiubli@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).