Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1235141 > unrolled thread

[PATCH 1/3] kernel/audit: audit_dummy_context can be boolean

Started byYaowei Bai <bywxiaobai@163.com>
First post2015-09-29 16:20 +0200
Last post2015-09-29 20:30 +0200
Articles 6 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/3] kernel/audit: audit_dummy_context can be boolean Yaowei Bai <bywxiaobai@163.com> - 2015-09-29 16:20 +0200
    [PATCH 3/3] kernel/audit: audit_tree_match can be boolean Yaowei Bai <bywxiaobai@163.com> - 2015-09-29 16:20 +0200
      Re: [PATCH 3/3] kernel/audit: audit_tree_match can be boolean Paul Moore <paul@paul-moore.com> - 2015-09-29 20:50 +0200
    [PATCH 2/3] kernel/audit: audit_string_contains_control can be boolean Yaowei Bai <bywxiaobai@163.com> - 2015-09-29 16:20 +0200
      Re: [PATCH 2/3] kernel/audit: audit_string_contains_control can be boolean Paul Moore <paul@paul-moore.com> - 2015-09-29 20:40 +0200
    Re: [PATCH 1/3] kernel/audit: audit_dummy_context can be boolean Paul Moore <paul@paul-moore.com> - 2015-09-29 20:30 +0200

#1235141 — [PATCH 1/3] kernel/audit: audit_dummy_context can be boolean

FromYaowei Bai <bywxiaobai@163.com>
Date2015-09-29 16:20 +0200
Subject[PATCH 1/3] kernel/audit: audit_dummy_context can be boolean
Message-ID<qe3V8-rR-1@gated-at.bofh.it>
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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1235148 — [PATCH 3/3] kernel/audit: audit_tree_match can be boolean

FromYaowei Bai <bywxiaobai@163.com>
Date2015-09-29 16:20 +0200
Subject[PATCH 3/3] kernel/audit: audit_tree_match can be boolean
Message-ID<qe3V9-rR-33@gated-at.bofh.it>
In reply to#1235141
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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1235484 — Re: [PATCH 3/3] kernel/audit: audit_tree_match can be boolean

FromPaul Moore <paul@paul-moore.com>
Date2015-09-29 20:50 +0200
SubjectRe: [PATCH 3/3] kernel/audit: audit_tree_match can be boolean
Message-ID<qe88q-6lN-7@gated-at.bofh.it>
In reply to#1235148
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1235150 — [PATCH 2/3] kernel/audit: audit_string_contains_control can be boolean

FromYaowei Bai <bywxiaobai@163.com>
Date2015-09-29 16:20 +0200
Subject[PATCH 2/3] kernel/audit: audit_string_contains_control can be boolean
Message-ID<qe3V9-rR-25@gated-at.bofh.it>
In reply to#1235141
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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1235476 — Re: [PATCH 2/3] kernel/audit: audit_string_contains_control can be boolean

FromPaul Moore <paul@paul-moore.com>
Date2015-09-29 20:40 +0200
SubjectRe: [PATCH 2/3] kernel/audit: audit_string_contains_control can be boolean
Message-ID<qe7YK-6an-33@gated-at.bofh.it>
In reply to#1235150
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1235467

FromPaul Moore <paul@paul-moore.com>
Date2015-09-29 20:30 +0200
Message-ID<qe7P4-5Ze-13@gated-at.bofh.it>
In reply to#1235141
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web