* [PATCH 1/3] kernel/audit: audit_dummy_context can be boolean
@ 2015-09-29 14:15 Yaowei Bai
2015-09-29 14:15 ` [PATCH 2/3] kernel/audit: audit_string_contains_control " Yaowei Bai
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Yaowei Bai @ 2015-09-29 14:15 UTC (permalink / raw)
To: paul, eparis; +Cc: linux-audit, linux-kernel
This patch makes audit_dummy_context return bool due to this
particular function only using either one or zero as its return
value.
No functional change.
Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
---
include/linux/audit.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/linux/audit.h b/include/linux/audit.h
index b2abc99..69844b6 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -143,7 +143,7 @@ extern void __audit_inode_child(const struct inode *parent,
extern void __audit_seccomp(unsigned long syscall, long signr, int code);
extern void __audit_ptrace(struct task_struct *t);
-static inline int audit_dummy_context(void)
+static inline bool audit_dummy_context(void)
{
void *p = current->audit_context;
return !p || *(int *)p;
@@ -345,9 +345,9 @@ static inline void audit_syscall_entry(int major, unsigned long a0,
{ }
static inline void audit_syscall_exit(void *pt_regs)
{ }
-static inline int audit_dummy_context(void)
+static inline bool audit_dummy_context(void)
{
- return 1;
+ return true;
}
static inline struct filename *audit_reusename(const __user char *name)
{
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] kernel/audit: audit_string_contains_control can be boolean
2015-09-29 14:15 [PATCH 1/3] kernel/audit: audit_dummy_context can be boolean Yaowei Bai
@ 2015-09-29 14:15 ` Yaowei Bai
2015-09-29 18:37 ` Paul Moore
2015-09-29 14:15 ` [PATCH 3/3] kernel/audit: audit_tree_match " Yaowei Bai
2015-09-29 18:23 ` [PATCH 1/3] kernel/audit: audit_dummy_context " Paul Moore
2 siblings, 1 reply; 6+ messages in thread
From: Yaowei Bai @ 2015-09-29 14:15 UTC (permalink / raw)
To: paul, eparis; +Cc: linux-audit, linux-kernel
This patch makes audit_string_contains_control return bool to improve
readability due to this particular function only using either one or
zero as its return value.
Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
---
include/linux/audit.h | 2 +-
kernel/audit.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 69844b6..20eba1e 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -457,7 +457,7 @@ extern struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp
extern __printf(2, 3)
void audit_log_format(struct audit_buffer *ab, const char *fmt, ...);
extern void audit_log_end(struct audit_buffer *ab);
-extern int audit_string_contains_control(const char *string,
+extern bool audit_string_contains_control(const char *string,
size_t len);
extern void audit_log_n_hex(struct audit_buffer *ab,
const unsigned char *buf,
diff --git a/kernel/audit.c b/kernel/audit.c
index 662c007..86d423c 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -1566,14 +1566,14 @@ void audit_log_n_string(struct audit_buffer *ab, const char *string,
* @string: string to be checked
* @len: max length of the string to check
*/
-int audit_string_contains_control(const char *string, size_t len)
+bool audit_string_contains_control(const char *string, size_t len)
{
const unsigned char *p;
for (p = string; p < (const unsigned char *)string + len; p++) {
if (*p == '"' || *p < 0x21 || *p > 0x7e)
- return 1;
+ return true;
}
- return 0;
+ return false;
}
/**
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] kernel/audit: audit_tree_match can be boolean
2015-09-29 14:15 [PATCH 1/3] kernel/audit: audit_dummy_context can be boolean Yaowei Bai
2015-09-29 14:15 ` [PATCH 2/3] kernel/audit: audit_string_contains_control " Yaowei Bai
@ 2015-09-29 14:15 ` Yaowei Bai
2015-09-29 18:47 ` Paul Moore
2015-09-29 18:23 ` [PATCH 1/3] kernel/audit: audit_dummy_context " Paul Moore
2 siblings, 1 reply; 6+ messages in thread
From: Yaowei Bai @ 2015-09-29 14:15 UTC (permalink / raw)
To: paul, eparis; +Cc: linux-audit, linux-kernel
This patch makes audit_tree_match return bool to improve readability
due to this particular function only using either one or zero as its
return value.
No functional change.
Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
---
kernel/audit.h | 2 +-
kernel/audit_tree.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/audit.h b/kernel/audit.h
index dadf86a..de6cbb7 100644
--- a/kernel/audit.h
+++ b/kernel/audit.h
@@ -301,7 +301,7 @@ extern int audit_exe_compare(struct task_struct *tsk, struct audit_fsnotify_mark
#ifdef CONFIG_AUDIT_TREE
extern struct audit_chunk *audit_tree_lookup(const struct inode *);
extern void audit_put_chunk(struct audit_chunk *);
-extern int audit_tree_match(struct audit_chunk *, struct audit_tree *);
+extern bool audit_tree_match(struct audit_chunk *, struct audit_tree *);
extern int audit_make_tree(struct audit_krule *, char *, u32);
extern int audit_add_tree_rule(struct audit_krule *);
extern int audit_remove_tree_rule(struct audit_krule *);
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c
index 94ecdab..5efe9b29 100644
--- a/kernel/audit_tree.c
+++ b/kernel/audit_tree.c
@@ -197,13 +197,13 @@ struct audit_chunk *audit_tree_lookup(const struct inode *inode)
return NULL;
}
-int audit_tree_match(struct audit_chunk *chunk, struct audit_tree *tree)
+bool audit_tree_match(struct audit_chunk *chunk, struct audit_tree *tree)
{
int n;
for (n = 0; n < chunk->count; n++)
if (chunk->owners[n].owner == tree)
- return 1;
- return 0;
+ return true;
+ return false;
}
/* tagging and untagging inodes with trees */
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] kernel/audit: audit_dummy_context can be boolean
2015-09-29 14:15 [PATCH 1/3] kernel/audit: audit_dummy_context can be boolean Yaowei Bai
2015-09-29 14:15 ` [PATCH 2/3] kernel/audit: audit_string_contains_control " Yaowei Bai
2015-09-29 14:15 ` [PATCH 3/3] kernel/audit: audit_tree_match " Yaowei Bai
@ 2015-09-29 18:23 ` Paul Moore
2 siblings, 0 replies; 6+ messages in thread
From: Paul Moore @ 2015-09-29 18:23 UTC (permalink / raw)
To: Yaowei Bai; +Cc: eparis, linux-audit, linux-kernel
On Tuesday, September 29, 2015 10:15:39 PM Yaowei Bai wrote:
> This patch makes audit_dummy_context return bool due to this
> particular function only using either one or zero as its return
> value.
>
> No functional change.
>
> Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
> ---
> include/linux/audit.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
Applied.
> diff --git a/include/linux/audit.h b/include/linux/audit.h
> index b2abc99..69844b6 100644
> --- a/include/linux/audit.h
> +++ b/include/linux/audit.h
> @@ -143,7 +143,7 @@ extern void __audit_inode_child(const struct inode
> *parent, extern void __audit_seccomp(unsigned long syscall, long signr, int
> code); extern void __audit_ptrace(struct task_struct *t);
>
> -static inline int audit_dummy_context(void)
> +static inline bool audit_dummy_context(void)
> {
> void *p = current->audit_context;
> return !p || *(int *)p;
> @@ -345,9 +345,9 @@ static inline void audit_syscall_entry(int major,
> unsigned long a0, { }
> static inline void audit_syscall_exit(void *pt_regs)
> { }
> -static inline int audit_dummy_context(void)
> +static inline bool audit_dummy_context(void)
> {
> - return 1;
> + return true;
> }
> static inline struct filename *audit_reusename(const __user char *name)
> {
--
paul moore
www.paul-moore.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] kernel/audit: audit_string_contains_control can be boolean
2015-09-29 14:15 ` [PATCH 2/3] kernel/audit: audit_string_contains_control " Yaowei Bai
@ 2015-09-29 18:37 ` Paul Moore
0 siblings, 0 replies; 6+ messages in thread
From: Paul Moore @ 2015-09-29 18:37 UTC (permalink / raw)
To: Yaowei Bai; +Cc: eparis, linux-audit, linux-kernel
On Tuesday, September 29, 2015 10:15:40 PM Yaowei Bai wrote:
> This patch makes audit_string_contains_control return bool to improve
> readability due to this particular function only using either one or
> zero as its return value.
>
> Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
> ---
> include/linux/audit.h | 2 +-
> kernel/audit.c | 6 +++---
> 2 files changed, 4 insertions(+), 4 deletions(-)
Applied.
> diff --git a/include/linux/audit.h b/include/linux/audit.h
> index 69844b6..20eba1e 100644
> --- a/include/linux/audit.h
> +++ b/include/linux/audit.h
> @@ -457,7 +457,7 @@ extern struct audit_buffer *audit_log_start(struct
> audit_context *ctx, gfp_t gfp extern __printf(2, 3)
> void audit_log_format(struct audit_buffer *ab, const char *fmt, ...);
> extern void audit_log_end(struct audit_buffer *ab);
> -extern int audit_string_contains_control(const char *string,
> +extern bool audit_string_contains_control(const char *string,
> size_t len);
> extern void audit_log_n_hex(struct audit_buffer *ab,
> const unsigned char *buf,
> diff --git a/kernel/audit.c b/kernel/audit.c
> index 662c007..86d423c 100644
> --- a/kernel/audit.c
> +++ b/kernel/audit.c
> @@ -1566,14 +1566,14 @@ void audit_log_n_string(struct audit_buffer *ab,
> const char *string, * @string: string to be checked
> * @len: max length of the string to check
> */
> -int audit_string_contains_control(const char *string, size_t len)
> +bool audit_string_contains_control(const char *string, size_t len)
> {
> const unsigned char *p;
> for (p = string; p < (const unsigned char *)string + len; p++) {
> if (*p == '"' || *p < 0x21 || *p > 0x7e)
> - return 1;
> + return true;
> }
> - return 0;
> + return false;
> }
>
> /**
--
paul moore
www.paul-moore.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] kernel/audit: audit_tree_match can be boolean
2015-09-29 14:15 ` [PATCH 3/3] kernel/audit: audit_tree_match " Yaowei Bai
@ 2015-09-29 18:47 ` Paul Moore
0 siblings, 0 replies; 6+ messages in thread
From: Paul Moore @ 2015-09-29 18:47 UTC (permalink / raw)
To: Yaowei Bai; +Cc: eparis, linux-audit, linux-kernel
On Tuesday, September 29, 2015 10:15:41 PM Yaowei Bai wrote:
> This patch makes audit_tree_match return bool to improve readability
> due to this particular function only using either one or zero as its
> return value.
>
> No functional change.
>
> Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
> ---
> kernel/audit.h | 2 +-
> kernel/audit_tree.c | 6 +++---
> 2 files changed, 4 insertions(+), 4 deletions(-)
Applied, thanks.
> diff --git a/kernel/audit.h b/kernel/audit.h
> index dadf86a..de6cbb7 100644
> --- a/kernel/audit.h
> +++ b/kernel/audit.h
> @@ -301,7 +301,7 @@ extern int audit_exe_compare(struct task_struct *tsk,
> struct audit_fsnotify_mark #ifdef CONFIG_AUDIT_TREE
> extern struct audit_chunk *audit_tree_lookup(const struct inode *);
> extern void audit_put_chunk(struct audit_chunk *);
> -extern int audit_tree_match(struct audit_chunk *, struct audit_tree *);
> +extern bool audit_tree_match(struct audit_chunk *, struct audit_tree *);
> extern int audit_make_tree(struct audit_krule *, char *, u32);
> extern int audit_add_tree_rule(struct audit_krule *);
> extern int audit_remove_tree_rule(struct audit_krule *);
> diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c
> index 94ecdab..5efe9b29 100644
> --- a/kernel/audit_tree.c
> +++ b/kernel/audit_tree.c
> @@ -197,13 +197,13 @@ struct audit_chunk *audit_tree_lookup(const struct
> inode *inode) return NULL;
> }
>
> -int audit_tree_match(struct audit_chunk *chunk, struct audit_tree *tree)
> +bool audit_tree_match(struct audit_chunk *chunk, struct audit_tree *tree)
> {
> int n;
> for (n = 0; n < chunk->count; n++)
> if (chunk->owners[n].owner == tree)
> - return 1;
> - return 0;
> + return true;
> + return false;
> }
>
> /* tagging and untagging inodes with trees */
--
paul moore
www.paul-moore.com
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-09-29 18:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-29 14:15 [PATCH 1/3] kernel/audit: audit_dummy_context can be boolean Yaowei Bai
2015-09-29 14:15 ` [PATCH 2/3] kernel/audit: audit_string_contains_control " Yaowei Bai
2015-09-29 18:37 ` Paul Moore
2015-09-29 14:15 ` [PATCH 3/3] kernel/audit: audit_tree_match " Yaowei Bai
2015-09-29 18:47 ` Paul Moore
2015-09-29 18:23 ` [PATCH 1/3] kernel/audit: audit_dummy_context " Paul Moore
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).