* [PATCH -next, v3 1/2] audit: use struct_size() helper in audit_[send|make]_reply()
@ 2021-12-17 1:01 ` Xiu Jianfeng
0 siblings, 0 replies; 9+ messages in thread
From: Xiu Jianfeng @ 2021-12-17 1:01 UTC (permalink / raw)
To: paul, eparis, gustavoars, keescook
Cc: linux-audit, linux-kernel, linux-hardening
Make use of struct_size() helper instead of an open-coded calculation.
Link: https://github.com/KSPP/linux/issues/160
Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
---
kernel/audit.c | 2 +-
kernel/auditfilter.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/audit.c b/kernel/audit.c
index f33028578c60..7778eca34837 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -1459,7 +1459,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
security_release_secctx(ctx, len);
}
audit_send_reply(skb, seq, AUDIT_SIGNAL_INFO, 0, 0,
- sig_data, sizeof(*sig_data) + len);
+ sig_data, struct_size(sig_data, ctx, len));
kfree(sig_data);
break;
case AUDIT_TTY_GET: {
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index 19352820b274..42d99896e7a6 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -1092,7 +1092,7 @@ static void audit_list_rules(int seq, struct sk_buff_head *q)
break;
skb = audit_make_reply(seq, AUDIT_LIST_RULES, 0, 1,
data,
- sizeof(*data) + data->buflen);
+ struct_size(data, buf, data->buflen));
if (skb)
skb_queue_tail(q, skb);
kfree(data);
--
2.17.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH -next, v3 1/2] audit: use struct_size() helper in audit_[send|make]_reply()
@ 2021-12-17 1:01 ` Xiu Jianfeng
0 siblings, 0 replies; 9+ messages in thread
From: Xiu Jianfeng @ 2021-12-17 1:01 UTC (permalink / raw)
To: paul, eparis, gustavoars, keescook
Cc: linux-audit, linux-kernel, linux-hardening
Make use of struct_size() helper instead of an open-coded calculation.
Link: https://github.com/KSPP/linux/issues/160
Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
---
kernel/audit.c | 2 +-
kernel/auditfilter.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/audit.c b/kernel/audit.c
index f33028578c60..7778eca34837 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -1459,7 +1459,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
security_release_secctx(ctx, len);
}
audit_send_reply(skb, seq, AUDIT_SIGNAL_INFO, 0, 0,
- sig_data, sizeof(*sig_data) + len);
+ sig_data, struct_size(sig_data, ctx, len));
kfree(sig_data);
break;
case AUDIT_TTY_GET: {
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index 19352820b274..42d99896e7a6 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -1092,7 +1092,7 @@ static void audit_list_rules(int seq, struct sk_buff_head *q)
break;
skb = audit_make_reply(seq, AUDIT_LIST_RULES, 0, 1,
data,
- sizeof(*data) + data->buflen);
+ struct_size(data, buf, data->buflen));
if (skb)
skb_queue_tail(q, skb);
kfree(data);
--
2.17.1
--
Linux-audit mailing list
Linux-audit@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-audit
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH -next, v3 2/2] audit: replace zero-length array with flexible-array member
2021-12-17 1:01 ` Xiu Jianfeng
@ 2021-12-17 1:01 ` Xiu Jianfeng
-1 siblings, 0 replies; 9+ messages in thread
From: Xiu Jianfeng @ 2021-12-17 1:01 UTC (permalink / raw)
To: paul, eparis, gustavoars, keescook
Cc: linux-audit, linux-kernel, linux-hardening
Zero-length arrays are deprecated and should be replaced with
flexible-array members.
Link: https://github.com/KSPP/linux/issues/78
Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
---
include/uapi/linux/audit.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index 9176a095fefc..8eda133ca4c1 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -514,7 +514,7 @@ struct audit_rule_data {
__u32 values[AUDIT_MAX_FIELDS];
__u32 fieldflags[AUDIT_MAX_FIELDS];
__u32 buflen; /* total length of string fields */
- char buf[0]; /* string fields buffer */
+ char buf[]; /* string fields buffer */
};
#endif /* _UAPI_LINUX_AUDIT_H_ */
--
2.17.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH -next, v3 2/2] audit: replace zero-length array with flexible-array member
@ 2021-12-17 1:01 ` Xiu Jianfeng
0 siblings, 0 replies; 9+ messages in thread
From: Xiu Jianfeng @ 2021-12-17 1:01 UTC (permalink / raw)
To: paul, eparis, gustavoars, keescook
Cc: linux-audit, linux-kernel, linux-hardening
Zero-length arrays are deprecated and should be replaced with
flexible-array members.
Link: https://github.com/KSPP/linux/issues/78
Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
---
include/uapi/linux/audit.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index 9176a095fefc..8eda133ca4c1 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -514,7 +514,7 @@ struct audit_rule_data {
__u32 values[AUDIT_MAX_FIELDS];
__u32 fieldflags[AUDIT_MAX_FIELDS];
__u32 buflen; /* total length of string fields */
- char buf[0]; /* string fields buffer */
+ char buf[]; /* string fields buffer */
};
#endif /* _UAPI_LINUX_AUDIT_H_ */
--
2.17.1
--
Linux-audit mailing list
Linux-audit@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-audit
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH -next, v3 1/2] audit: use struct_size() helper in audit_[send|make]_reply()
2021-12-17 1:01 ` Xiu Jianfeng
@ 2021-12-20 19:52 ` Paul Moore
-1 siblings, 0 replies; 9+ messages in thread
From: Paul Moore @ 2021-12-20 19:52 UTC (permalink / raw)
To: Xiu Jianfeng
Cc: eparis, gustavoars, keescook, linux-audit, linux-kernel, linux-hardening
On Thu, Dec 16, 2021 at 8:01 PM Xiu Jianfeng <xiujianfeng@huawei.com> wrote:
>
> Make use of struct_size() helper instead of an open-coded calculation.
>
> Link: https://github.com/KSPP/linux/issues/160
> Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
> ---
> kernel/audit.c | 2 +-
> kernel/auditfilter.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
Merged into audit/next, thanks!
--
paul moore
www.paul-moore.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH -next, v3 1/2] audit: use struct_size() helper in audit_[send|make]_reply()
@ 2021-12-20 19:52 ` Paul Moore
0 siblings, 0 replies; 9+ messages in thread
From: Paul Moore @ 2021-12-20 19:52 UTC (permalink / raw)
To: Xiu Jianfeng
Cc: linux-kernel, eparis, gustavoars, linux-audit, linux-hardening
On Thu, Dec 16, 2021 at 8:01 PM Xiu Jianfeng <xiujianfeng@huawei.com> wrote:
>
> Make use of struct_size() helper instead of an open-coded calculation.
>
> Link: https://github.com/KSPP/linux/issues/160
> Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
> ---
> kernel/audit.c | 2 +-
> kernel/auditfilter.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
Merged into audit/next, thanks!
--
paul moore
www.paul-moore.com
--
Linux-audit mailing list
Linux-audit@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-audit
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH -next, v3 2/2] audit: replace zero-length array with flexible-array member
2021-12-17 1:01 ` Xiu Jianfeng
@ 2021-12-20 21:20 ` Paul Moore
-1 siblings, 0 replies; 9+ messages in thread
From: Paul Moore @ 2021-12-20 21:20 UTC (permalink / raw)
To: Xiu Jianfeng
Cc: eparis, gustavoars, keescook, linux-audit, linux-kernel, linux-hardening
On Thu, Dec 16, 2021 at 8:01 PM Xiu Jianfeng <xiujianfeng@huawei.com> wrote:
>
> Zero-length arrays are deprecated and should be replaced with
> flexible-array members.
>
> Link: https://github.com/KSPP/linux/issues/78
> Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
> ---
> include/uapi/linux/audit.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
It doesn't look like this shouldn't impact the UAPI so I've also
merged into audit/next, thanks!
--
paul moore
www.paul-moore.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH -next, v3 2/2] audit: replace zero-length array with flexible-array member
@ 2021-12-20 21:20 ` Paul Moore
0 siblings, 0 replies; 9+ messages in thread
From: Paul Moore @ 2021-12-20 21:20 UTC (permalink / raw)
To: Xiu Jianfeng
Cc: linux-kernel, eparis, gustavoars, linux-audit, linux-hardening
On Thu, Dec 16, 2021 at 8:01 PM Xiu Jianfeng <xiujianfeng@huawei.com> wrote:
>
> Zero-length arrays are deprecated and should be replaced with
> flexible-array members.
>
> Link: https://github.com/KSPP/linux/issues/78
> Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
> ---
> include/uapi/linux/audit.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
It doesn't look like this shouldn't impact the UAPI so I've also
merged into audit/next, thanks!
--
paul moore
www.paul-moore.com
--
Linux-audit mailing list
Linux-audit@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-audit
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH -next, v3 1/2] audit: use struct_size() helper in audit_[send|make]_reply()
@ 2021-12-16 2:08 Xiu Jianfeng
0 siblings, 0 replies; 9+ messages in thread
From: Xiu Jianfeng @ 2021-12-16 2:08 UTC (permalink / raw)
To: paul, eparis, keescook, gustavoars; +Cc: linux-kernel, linux-hardening
Make use of struct_size() helper instead of an open-coded calculation.
Link: https://github.com/KSPP/linux/issues/160
Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
---
kernel/audit.c | 2 +-
kernel/auditfilter.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/audit.c b/kernel/audit.c
index f33028578c60..7778eca34837 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -1459,7 +1459,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
security_release_secctx(ctx, len);
}
audit_send_reply(skb, seq, AUDIT_SIGNAL_INFO, 0, 0,
- sig_data, sizeof(*sig_data) + len);
+ sig_data, struct_size(sig_data, ctx, len));
kfree(sig_data);
break;
case AUDIT_TTY_GET: {
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index 19352820b274..42d99896e7a6 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -1092,7 +1092,7 @@ static void audit_list_rules(int seq, struct sk_buff_head *q)
break;
skb = audit_make_reply(seq, AUDIT_LIST_RULES, 0, 1,
data,
- sizeof(*data) + data->buflen);
+ struct_size(data, buf, data->buflen));
if (skb)
skb_queue_tail(q, skb);
kfree(data);
--
2.17.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-12-20 21:23 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-17 1:01 [PATCH -next, v3 1/2] audit: use struct_size() helper in audit_[send|make]_reply() Xiu Jianfeng
2021-12-17 1:01 ` Xiu Jianfeng
2021-12-17 1:01 ` [PATCH -next, v3 2/2] audit: replace zero-length array with flexible-array member Xiu Jianfeng
2021-12-17 1:01 ` Xiu Jianfeng
2021-12-20 21:20 ` Paul Moore
2021-12-20 21:20 ` Paul Moore
2021-12-20 19:52 ` [PATCH -next, v3 1/2] audit: use struct_size() helper in audit_[send|make]_reply() Paul Moore
2021-12-20 19:52 ` Paul Moore
-- strict thread matches above, loose matches on Subject: below --
2021-12-16 2:08 Xiu Jianfeng
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.