Skip to contentSkip to conversation

lsm: add comment block for security_sk_classify_flow LSM hook

PATCH Superseded Khadija Kamran 3 participants 4 messages Jul 31, 2023 – Aug 7, 2023 Security (LSM)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lsm: add comment block for security_sk_classify_flow LSM hook

security_sk_classify_flow LSM hook has no comment block. Add a comment block with a brief description of LSM hook and its function parameters.

---
 security/security.c | 7 +++++++
 1 file changed, 7 insertions(+)
security/security.c +7 -0
index d5ff7ff45b77..ffc5519e49cd 100644
@@ -4396,6 +4396,13 @@ void security_sk_clone(const struct sock *sk, struct sock *newsk)
 }
 EXPORT_SYMBOL(security_sk_clone);
 
+/**
+ * security_sk_classify_flow() - Set a flow's secid based on socket
+ * @sk:  original socket
+ * @flic: target flow
+ *
+ * Set the target flow's secid to socket's secid.
+ */
 void security_sk_classify_flow(struct sock *sk, struct flowi_common *flic)
 {
 	call_void_hook(sk_getsecid, sk, &flic->flowic_secid);
Signature · 1 line
2.34.1
#1 lore raw
Quoted 2 lines · Khadija Kamran

security_sk_classify_flow LSM hook has no comment block. Add a comment block with a brief description of LSM hook and its function parameters.

When referring to functions, in the one line commit message, or here in the commit log, it is customary to add the parenthesis to be clear it is a function name.

ie. security_sk_classify_flow()

Quoted 11 lines
---
 security/security.c | 7 +++++++
 1 file changed, 7 insertions(+)
security/security.c +0 -0
index d5ff7ff45b77..ffc5519e49cd 100644

security/security.c void security_sk_clone(const struct sock *sk, struct sock *newsk) · line 4401

Quoted 6 lines
security/security.c +3 -0
@@ -4396,6 +4396,13 @@ void security_sk_clone(const struct sock *sk, struct sock *newsk)
 }
 EXPORT_SYMBOL(security_sk_clone);
 
+/**
+ * security_sk_classify_flow() - Set a flow's secid based on socket
+ * @sk:  original socket

^errant space

Quoted 10 lines
security/security.c +4 -0
+ * @flic: target flow
+ *
+ * Set the target flow's secid to socket's secid.
+ */
 void security_sk_classify_flow(struct sock *sk, struct flowi_common *flic)
 {
 	call_void_hook(sk_getsecid, sk, &flic->flowic_secid);
Signature · 1 line
2.34.1
maintainer
#3 lore raw
In reply to Khadija Kamran
Quoted 8 lines · On Jul 31, 2023 Khadija Kamran wrote:

security_sk_classify_flow LSM hook has no comment block. Add a comment block with a brief description of LSM hook and its function parameters.

---
 security/security.c | 7 +++++++
 1 file changed, 7 insertions(+)

Thanks Khadija. I did make a small change to your patch (see below) when merging it into the lsm/next branch.

security/security.c void security_sk_clone(const struct sock *sk, struct sock *newsk) · line 4401

Quoted 11 lines
security/security.c +3 -0
index d5ff7ff45b77..ffc5519e49cd 100644
@@ -4396,6 +4396,13 @@ void security_sk_clone(const struct sock *sk, struct sock *newsk)
 }
 EXPORT_SYMBOL(security_sk_clone);
 
+/**
+ * security_sk_classify_flow() - Set a flow's secid based on socket
+ * @sk:  original socket

As has been pointed out previously, there is a double-space between "sk:" and "original socket".

Quoted 9 lines
security/security.c +4 -0
+ * @flic: target flow
+ *
+ * Set the target flow's secid to socket's secid.
+ */
 void security_sk_classify_flow(struct sock *sk, struct flowi_common *flic)
 {
 	call_void_hook(sk_getsecid, sk, &flic->flowic_secid);
Signature · 1 line
2.34.1

--
paul-moore.com

#2 lore raw
In reply to Alison Schofield
Quoted 24 lines · Alison Schofield
Quoted 2 lines · Khadija Kamran

security_sk_classify_flow LSM hook has no comment block. Add a comment block with a brief description of LSM hook and its function parameters.

When referring to functions, in the one line commit message, or here in the commit log, it is customary to add the parenthesis to be clear it is a function name.

ie. security_sk_classify_flow()

Quoted 14 lines
---
 security/security.c | 7 +++++++
 1 file changed, 7 insertions(+)
security/security.c +0 -0
index d5ff7ff45b77..ffc5519e49cd 100644
@@ -4396,6 +4396,13 @@ void security_sk_clone(const struct sock *sk, struct sock *newsk)
 }
 EXPORT_SYMBOL(security_sk_clone);
 
Quoted 5 lines

security/security.c void security_sk_clone(const struct sock *sk, struct sock *newsk) · line 4401

Quoted 3 lines
security/security.c +3 -0
+/**
+ * security_sk_classify_flow() - Set a flow's secid based on socket
+ * @sk:  original socket

^errant space

Hey Alison,
Noted. Thank you.

Quoted 10 lines
Quoted 10 lines
security/security.c +4 -0
+ * @flic: target flow
+ *
+ * Set the target flow's secid to socket's secid.
+ */
 void security_sk_classify_flow(struct sock *sk, struct flowi_common *flic)
 {
 	call_void_hook(sk_getsecid, sk, &flic->flowic_secid);
Signature · 1 line
2.34.1