Skip to contentSkip to conversation

keyctl.h: update pointer types

PATCH In review Ben Boeckel 2 participants 3 messages Sep 27, 2018 Keys/keyrings

lore
Share & tools
lore
#0 lore raw

PATCH 4/5 keyctl.h: update pointer types

These should be const since the kernel should not touch them. In addition otherinfo is defined to be opaque, so make it a void *.

---
 include/uapi/linux/keyctl.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/uapi/linux/keyctl.h +2 -2
index 1a5a7948606e..6004e05b685b 100644
@@ -76,8 +76,8 @@ struct keyctl_dh_params {
 };
 
 struct keyctl_kdf_params {
-	char __user *hashname;
-	char __user *otherinfo;
+	const char __user *hashname;
+	const void __user *otherinfo;
 	__u32 otherinfolen;
 	__u32 __spare[8];
 };
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 2 lines · Ben Boeckel

These should be const since the kernel should not touch them. In addition otherinfo is defined to be opaque, so make it a void *.

You're changing the UAPI - and this no longer matches what's in keyutils.h in userspace.

The UAPI change might potentially cause userspace to fail to compile if someone was assigning the char * pointer from the struct to another char * pointer.

Unless there's an actual bug to fix (see the 'private' problem), I would strongly recommend living with this.

David

#2 lore raw
In reply to Ben Boeckel
Quoted 6 lines · David Howells
Quoted 2 lines · Ben Boeckel

These should be const since the kernel should not touch them. In addition otherinfo is defined to be opaque, so make it a void *.

You're changing the UAPI - and this no longer matches what's in keyutils.h in userspace.

Please see patch #5/7 of the keyutils patches on this thread for that change.

Quoted 3 lines

The UAPI change might potentially cause userspace to fail to compile if someone was assigning the char * pointer from the struct to another char * pointer.

Is this in a released kernel? Isn't the KDF code being added in another pull request of yours[1]?

--Ben

[1]https://lwn.net/Articles/764227/