2017-08-07 13:44:39

by Geliang Tang

[permalink] [raw]
Subject: [PATCH] audit: update the function comments

Update the function comments to match the code.

Signed-off-by: Geliang Tang <[email protected]>
---
kernel/audit.c | 2 +-
kernel/auditsc.c | 18 +++++++++---------
2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/kernel/audit.c b/kernel/audit.c
index 0cf15c7..be1c28f 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -1833,7 +1833,7 @@ void audit_log_format(struct audit_buffer *ab, const char *fmt, ...)
}

/**
- * audit_log_hex - convert a buffer to hex and append it to the audit skb
+ * audit_log_n_hex - convert a buffer to hex and append it to the audit skb
* @ab: the audit_buffer
* @buf: buffer to convert to hex
* @len: length of @buf to be converted
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index fd72e11..aac1a41 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1462,7 +1462,7 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts
}

/**
- * audit_free - free a per-task audit context
+ * __audit_free - free a per-task audit context
* @tsk: task whose audit context block to free
*
* Called from copy_process and do_exit
@@ -1489,7 +1489,7 @@ void __audit_free(struct task_struct *tsk)
}

/**
- * audit_syscall_entry - fill in an audit record at syscall entry
+ * __audit_syscall_entry - fill in an audit record at syscall entry
* @major: major syscall type (function)
* @a1: additional syscall register 1
* @a2: additional syscall register 2
@@ -1543,7 +1543,7 @@ void __audit_syscall_entry(int major, unsigned long a1, unsigned long a2,
}

/**
- * audit_syscall_exit - deallocate audit context after a system call
+ * __audit_syscall_exit - deallocate audit context after a system call
* @success: success value of the syscall
* @return_code: return value of the syscall
*
@@ -1705,7 +1705,7 @@ static struct audit_names *audit_alloc_name(struct audit_context *context,
}

/**
- * audit_reusename - fill out filename with info from existing entry
+ * __audit_reusename - fill out filename with info from existing entry
* @uptr: userland ptr to pathname
*
* Search the audit_names list for the current audit context. If there is an
@@ -1730,7 +1730,7 @@ __audit_reusename(const __user char *uptr)
}

/**
- * audit_getname - add a name to the list
+ * __audit_getname - add a name to the list
* @name: name to add
*
* Add a name to the list of audit names for this context.
@@ -2135,7 +2135,7 @@ void __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
}

/**
- * audit_ipc_obj - record audit data for ipc object
+ * __audit_ipc_obj - record audit data for ipc object
* @ipcp: ipc permissions
*
*/
@@ -2151,7 +2151,7 @@ void __audit_ipc_obj(struct kern_ipc_perm *ipcp)
}

/**
- * audit_ipc_set_perm - record audit data for new ipc permissions
+ * __audit_ipc_set_perm - record audit data for new ipc permissions
* @qbytes: msgq bytes
* @uid: msgq user id
* @gid: msgq group id
@@ -2180,7 +2180,7 @@ void __audit_bprm(struct linux_binprm *bprm)


/**
- * audit_socketcall - record audit data for sys_socketcall
+ * __audit_socketcall - record audit data for sys_socketcall
* @nargs: number of args, which should not be more than AUDITSC_ARGS.
* @args: args array
*
@@ -2211,7 +2211,7 @@ void __audit_fd_pair(int fd1, int fd2)
}

/**
- * audit_sockaddr - record audit data for sys_bind, sys_connect, sys_sendto
+ * __audit_sockaddr - record audit data for sys_bind, sys_connect, sys_sendto
* @len: data length in user space
* @a: data address in kernel space
*
--
2.9.3


2017-08-07 13:44:50

by Geliang Tang

[permalink] [raw]
Subject: [PATCH] netfilter: ebtables: use audit_log()

Use audit_log() instead of open-coding it.

Signed-off-by: Geliang Tang <[email protected]>
---
net/bridge/netfilter/ebtables.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index 9c6e619..54c7ef4 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -1069,15 +1069,10 @@ static int do_replace_finish(struct net *net, struct ebt_replace *repl,

#ifdef CONFIG_AUDIT
if (audit_enabled) {
- struct audit_buffer *ab;
-
- ab = audit_log_start(current->audit_context, GFP_KERNEL,
- AUDIT_NETFILTER_CFG);
- if (ab) {
- audit_log_format(ab, "table=%s family=%u entries=%u",
- repl->name, AF_BRIDGE, repl->nentries);
- audit_log_end(ab);
- }
+ audit_log(current->audit_context, GFP_KERNEL,
+ AUDIT_NETFILTER_CFG,
+ "table=%s family=%u entries=%u",
+ repl->name, AF_BRIDGE, repl->nentries);
}
#endif
return ret;
--
2.9.3

2017-08-07 13:44:58

by Geliang Tang

[permalink] [raw]
Subject: [PATCH] netfilter: xtables: use audit_log()

Use audit_log() instead of open-coding it.

Signed-off-by: Geliang Tang <[email protected]>
---
net/netfilter/x_tables.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index e164823..c83a3b5 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -1192,16 +1192,10 @@ xt_replace_table(struct xt_table *table,

#ifdef CONFIG_AUDIT
if (audit_enabled) {
- struct audit_buffer *ab;
-
- ab = audit_log_start(current->audit_context, GFP_KERNEL,
- AUDIT_NETFILTER_CFG);
- if (ab) {
- audit_log_format(ab, "table=%s family=%u entries=%u",
- table->name, table->af,
- private->number);
- audit_log_end(ab);
- }
+ audit_log(current->audit_context, GFP_KERNEL,
+ AUDIT_NETFILTER_CFG,
+ "table=%s family=%u entries=%u",
+ table->name, table->af, private->number);
}
#endif

--
2.9.3

2017-08-07 13:45:05

by Geliang Tang

[permalink] [raw]
Subject: [PATCH] staging: media: atomisp: use kvmalloc/kvzalloc

Use kvmalloc()/kvzalloc() instead of atomisp_kernel_malloc()
/atomisp_kernel_zalloc().

Signed-off-by: Geliang Tang <[email protected]>
---
.../media/atomisp/pci/atomisp2/atomisp_cmd.c | 31 +---------------------
.../media/atomisp/pci/atomisp2/atomisp_cmd.h | 2 --
.../atomisp/pci/atomisp2/atomisp_compat_css20.c | 4 +--
.../media/atomisp/pci/atomisp2/atomisp_internal.h | 2 --
4 files changed, 3 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
index 7bf5dcd..f48bf45 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
@@ -83,35 +83,6 @@ union host {
};

/*
- * atomisp_kernel_malloc: chooses whether kmalloc() or vmalloc() is preferable.
- *
- * It is also a wrap functions to pass into css framework.
- */
-void *atomisp_kernel_malloc(size_t bytes)
-{
- /* vmalloc() is preferable if allocating more than 1 page */
- if (bytes > PAGE_SIZE)
- return vmalloc(bytes);
-
- return kmalloc(bytes, GFP_KERNEL);
-}
-
-/*
- * atomisp_kernel_zalloc: chooses whether set 0 to the allocated memory.
- *
- * It is also a wrap functions to pass into css framework.
- */
-void *atomisp_kernel_zalloc(size_t bytes, bool zero_mem)
-{
- void *ptr = atomisp_kernel_malloc(bytes);
-
- if (ptr && zero_mem)
- memset(ptr, 0, bytes);
-
- return ptr;
-}
-
-/*
* get sensor:dis71430/ov2720 related info from v4l2_subdev->priv data field.
* subdev->priv is set in mrst.c
*/
@@ -4316,7 +4287,7 @@ int atomisp_set_parameters(struct video_device *vdev,
* are ready, the parameters will be set to CSS.
* per-frame setting only works for the main output frame.
*/
- param = atomisp_kernel_zalloc(sizeof(*param), true);
+ param = kvzalloc(sizeof(*param), GFP_KERNEL);
if (!param) {
dev_err(asd->isp->dev, "%s: failed to alloc params buffer\n",
__func__);
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.h
index 1ccd911..31ba4e6 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.h
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.h
@@ -78,8 +78,6 @@ static inline void __iomem *atomisp_get_io_virt_addr(unsigned int address)
return ret;
}
*/
-void *atomisp_kernel_malloc(size_t bytes);
-void *atomisp_kernel_zalloc(size_t bytes, bool zero_mem);

/*
* Interrupt functions
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c
index 36f934d..05897b7 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c
@@ -1671,9 +1671,9 @@ int atomisp_alloc_metadata_output_buf(struct atomisp_sub_device *asd)
/* We allocate the cpu-side buffer used for communication with user
* space */
for (i = 0; i < ATOMISP_METADATA_TYPE_NUM; i++) {
- asd->params.metadata_user[i] = atomisp_kernel_malloc(
+ asd->params.metadata_user[i] = kvmalloc(
asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].
- stream_info.metadata_info.size);
+ stream_info.metadata_info.size, GFP_KERNEL);
if (!asd->params.metadata_user[i]) {
while (--i >= 0) {
kvfree(asd->params.metadata_user[i]);
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h
index 4b03f28..7542a72f 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h
@@ -301,8 +301,6 @@ struct atomisp_device {

extern struct device *atomisp_dev;

-extern void *atomisp_kernel_malloc(size_t bytes);
-
#define atomisp_is_wdt_running(a) timer_pending(&(a)->wdt)
#ifdef ISP2401
extern void atomisp_wdt_refresh_pipe(struct atomisp_video_pipe *pipe,
--
2.9.3

2017-08-07 23:25:21

by Paul Moore

[permalink] [raw]
Subject: Re: [PATCH] audit: update the function comments

On Mon, Aug 7, 2017 at 9:44 AM, Geliang Tang <[email protected]> wrote:
> Update the function comments to match the code.
>
> Signed-off-by: Geliang Tang <[email protected]>
> ---
> kernel/audit.c | 2 +-
> kernel/auditsc.c | 18 +++++++++---------
> 2 files changed, 10 insertions(+), 10 deletions(-)

I'm generally not a fan of cosmetic comment changes such as this, but
since it affects the kernel's doc tools I'm going to go ahead and
merge this, although it will likely not happen until tomorrow.

--
paul moore
http://www.paul-moore.com

2017-08-08 12:22:25

by Paul Moore

[permalink] [raw]
Subject: Re: [PATCH] audit: update the function comments

On Mon, Aug 7, 2017 at 7:25 PM, Paul Moore <[email protected]> wrote:
> On Mon, Aug 7, 2017 at 9:44 AM, Geliang Tang <[email protected]> wrote:
>> Update the function comments to match the code.
>>
>> Signed-off-by: Geliang Tang <[email protected]>
>> ---
>> kernel/audit.c | 2 +-
>> kernel/auditsc.c | 18 +++++++++---------
>> 2 files changed, 10 insertions(+), 10 deletions(-)
>
> I'm generally not a fan of cosmetic comment changes such as this, but
> since it affects the kernel's doc tools I'm going to go ahead and
> merge this, although it will likely not happen until tomorrow.

Merged into audit/next, thanks.

--
paul moore
http://www.paul-moore.com

2017-08-08 12:27:08

by Alan

[permalink] [raw]
Subject: Re: [PATCH] staging: media: atomisp: use kvmalloc/kvzalloc

On Mon, 2017-08-07 at 21:44 +0800, Geliang Tang wrote:
> Use kvmalloc()/kvzalloc() instead of atomisp_kernel_malloc()
> /atomisp_kernel_zalloc().
>
> Signed-off-by: Geliang Tang <[email protected]>

Definitely better now we have kvmalloc/kvzalloc.

Thanks

Alan

2017-08-19 11:25:43

by Pablo Neira Ayuso

[permalink] [raw]
Subject: Re: [PATCH] netfilter: ebtables: use audit_log()

On Mon, Aug 07, 2017 at 09:44:25PM +0800, Geliang Tang wrote:
> Use audit_log() instead of open-coding it.

Applied, thanks.

BTW, I have collapse your xtables change to this patch too. part of
the same logical change. Hint: If you see yourself writing exactly the
same description for each patch you submit then it's likely to be fine
to merge them into one single patch. Just for the next time.

2017-08-19 11:26:06

by Pablo Neira Ayuso

[permalink] [raw]
Subject: Re: [PATCH] netfilter: xtables: use audit_log()

On Mon, Aug 07, 2017 at 09:44:26PM +0800, Geliang Tang wrote:
> Use audit_log() instead of open-coding it.

As said, collapsed into 'netfilter: ebtables: use audit_log()', just
for the record.