public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] libceph: Make the input const as per the TODO
@ 2024-08-11 19:36 Abhinav Jain
  2024-08-11 20:57 ` Abhinav Jain
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Abhinav Jain @ 2024-08-11 19:36 UTC (permalink / raw)
  To: idryomov, xiubli, davem, edumazet, kuba, pabeni, ceph-devel,
	netdev, linux-kernel
  Cc: skhan, javier.carrasco.cruz, Abhinav Jain

Modify arguments to const in ceph_crypto_key_decode().
Modify ceph_key_preparse() in accordance with the changes.

Signed-off-by: Abhinav Jain <jain.abhinav177@gmail.com>
---
 net/ceph/crypto.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/net/ceph/crypto.c b/net/ceph/crypto.c
index 051d22c0e4ad..cfd485d6d3c5 100644
--- a/net/ceph/crypto.c
+++ b/net/ceph/crypto.c
@@ -86,7 +86,7 @@ int ceph_crypto_key_encode(struct ceph_crypto_key *key, void **p, void *end)
 	return 0;
 }
 
-int ceph_crypto_key_decode(struct ceph_crypto_key *key, void **p, void *end)
+int ceph_crypto_key_decode(struct ceph_crypto_key *key, const void **p, const void *end)
 {
 	int ret;
 
@@ -300,7 +300,7 @@ static int ceph_key_preparse(struct key_preparsed_payload *prep)
 	struct ceph_crypto_key *ckey;
 	size_t datalen = prep->datalen;
 	int ret;
-	void *p;
+	const void *p;
 
 	ret = -EINVAL;
 	if (datalen <= 0 || datalen > 32767 || !prep->data)
@@ -311,9 +311,8 @@ 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 char *)prep->data + datalen);
 	if (ret < 0)
 		goto err_ckey;
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-08-12  2:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-11 19:36 [PATCH net] libceph: Make the input const as per the TODO Abhinav Jain
2024-08-11 20:57 ` Abhinav Jain
2024-08-11 23:42 ` kernel test robot
2024-08-12  2:15 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox