Re: [PATCH 43/44] kdbus: Give up on failed fd allocation

2015-10-09 Thread Sergei Zviagintsev
Hi, On Thu, Oct 08, 2015 at 05:14:24PM +0200, David Herrmann wrote: > Hi > > On Thu, Oct 8, 2015 at 1:32 PM, Sergei Zviagintsev wrote: > > If we failed to allocate a file descriptor, do not try to do it again on > > the next iteration. There are few chances that we will hav

Re: [PATCH 38/44] kdbus: Fix error path in kdbus_user_lookup()

2015-10-09 Thread Sergei Zviagintsev
Hi David, On Thu, Oct 08, 2015 at 05:06:57PM +0200, David Herrmann wrote: > Hi > > On Thu, Oct 8, 2015 at 1:32 PM, Sergei Zviagintsev wrote: > > If idr_alloc() fails, we shouldn't call idr_remove() as latter produces > > warning when called on non-allocated ids. Spl

Re: [PATCH 31/44] kdbus: Cleanup kdbus_conn_move_messages()

2015-10-09 Thread Sergei Zviagintsev
Hi, On Thu, Oct 08, 2015 at 04:50:31PM +0200, David Herrmann wrote: > Hi > > On Thu, Oct 8, 2015 at 1:32 PM, Sergei Zviagintsev wrote: > > - Move `r' and `ret' to scopes where they are used. Drop redundant > >initialization of `ret'. > &

Re: [PATCH 26/44] kdbus: Cleanup kdbus_pin_dst()

2015-10-09 Thread Sergei Zviagintsev
Hi, On Thu, Oct 08, 2015 at 04:40:33PM +0200, David Herrmann wrote: > Hi > > On Thu, Oct 8, 2015 at 1:31 PM, Sergei Zviagintsev wrote: > > - Reduce scope of `owner' var to the block where it is actually used. > >Use conditional operator to set its value. > &g

Re: [PATCH 25/44] kdbus: Cleanup kdbus_cmd_conn_info()

2015-10-09 Thread Sergei Zviagintsev
Hi, On Thu, Oct 08, 2015 at 04:38:11PM +0200, David Herrmann wrote: > Hi > > On Thu, Oct 8, 2015 at 1:31 PM, Sergei Zviagintsev wrote: > > - Move `entry' and `owner' to the scope where they are used. Drop > >redundand initialization of `entry'. Use co

Re: [PATCH 24/44] kdbus: Cleanup kdbus_conn_unicast()

2015-10-09 Thread Sergei Zviagintsev
On Thu, Oct 08, 2015 at 04:34:27PM +0200, David Herrmann wrote: > Hi > > On Thu, Oct 8, 2015 at 1:31 PM, Sergei Zviagintsev wrote: > > Do not initialize `name' and `ret' as values are assigned to them at > > the first use by kdbus_pin_dst(). Simplify handling

Re: [PATCH 23/44] kdbus: Cleanup kdbus_conn_call()

2015-10-09 Thread Sergei Zviagintsev
On Thu, Oct 08, 2015 at 04:32:47PM +0200, David Herrmann wrote: > Hi > > On Thu, Oct 8, 2015 at 1:31 PM, Sergei Zviagintsev wrote: > > Do not initialize `wait' and `name' as values are assigned to them at > > first use: `wait' gets its value from kdbu

Re: [PATCH 05/44] kdbus: Add comment on merging free pool slices

2015-10-09 Thread Sergei Zviagintsev
Hi, On Thu, Oct 08, 2015 at 03:50:46PM +0200, David Herrmann wrote: > Hi > > On Thu, Oct 8, 2015 at 1:31 PM, Sergei Zviagintsev wrote: > > Add comment on why we remove the same slice from free slices tree and > > then add it back again when merging the slice to be relea

Re: [PATCH 21/44] kdbus: Cleanup tests in kdbus_cmd_send()

2015-10-09 Thread Sergei Zviagintsev
On Thu, Oct 08, 2015 at 04:30:59PM +0200, David Herrmann wrote: > Hi > > On Thu, Oct 8, 2015 at 1:31 PM, Sergei Zviagintsev wrote: > > Rearrange tests a little to make them look cleaner. > > What's wrong with 'else if'? Less verbose constructions are easier

Re: [PATCH 18/44] kdbus: Add var initialization to kdbus_conn_entry_insert()

2015-10-09 Thread Sergei Zviagintsev
Hi, On Thu, Oct 08, 2015 at 04:28:29PM +0200, David Herrmann wrote: > Hi > > On Thu, Oct 8, 2015 at 1:31 PM, Sergei Zviagintsev wrote: > > Assign zero to `ret' in the beginning of function instead of doing it > > in the end. > > > > Signed-off-by: Serg

Re: [PATCH 15/44] kdbus: Simplify bitwise expression in kdbus_meta_get_mask()

2015-10-09 Thread Sergei Zviagintsev
Hi David, On Thu, Oct 08, 2015 at 04:24:30PM +0200, David Herrmann wrote: > Hi > > On Thu, Oct 8, 2015 at 1:31 PM, Sergei Zviagintsev wrote: > > Replace the expression with more concise and readable equivalent. It can > > be proven by opening parentheses: > > >

Re: [PATCH 07/44] kdbus: Fix comment on translation of caps between namespaces

2015-10-09 Thread Sergei Zviagintsev
Hi, On Fri, Oct 09, 2015 at 11:43:22AM +0800, Hillf Danton wrote: > > @@ -730,15 +730,21 @@ static void kdbus_meta_export_caps(struct > > kdbus_meta_caps *out, > > > > /* > > * This translates the effective capabilities of 'cred' into the given > > -* user-namespace. If the given us

Re: [PATCH 00/44] kdbus cleanups

2015-10-09 Thread Sergei Zviagintsev
Hi David, On Thu, Oct 08, 2015 at 05:20:34PM +0200, David Herrmann wrote: > Hi > > On Thu, Oct 8, 2015 at 1:31 PM, Sergei Zviagintsev wrote: > > Hi all, > > > > This is a set of various kdbus code cleanups. Patches are ordered by > > increasing complexity, star

[PATCH 03/44] kdbus: Kernel-docs and comments trivial fixes

2015-10-08 Thread Sergei Zviagintsev
nd iovec as they relate to the old code. - struct kdbus_queue_entry: Fix typo: "messages" -> "message". - kdbus_pool_slice_publish(): Remove obsolete line from the description. Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/connection.c | 6 +++--- ipc/kdbus/conne

[PATCH 07/44] kdbus: Fix comment on translation of caps between namespaces

2015-10-08 Thread Sergei Zviagintsev
the process is a member of the given userns. Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/metadata.c | 24 +++- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/ipc/kdbus/metadata.c b/ipc/kdbus/metadata.c index 71ca475a80d5..4ff4b99a40e0 100644 --- a/ipc

[PATCH 06/44] kdbus: Fix kernel-doc for struct kdbus_gaps

2015-10-08 Thread Sergei Zviagintsev
Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/message.h | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ipc/kdbus/message.h b/ipc/kdbus/message.h index 298f9c99dfcf..405a5668f9d5 100644 --- a/ipc/kdbus/message.h +++ b/ipc/kdbus/message.h @@ -27,11 +27,12 @@ struct

[PATCH 09/44] kdbus: Remove unused KDBUS_MSG_MAX_SIZE constant

2015-10-08 Thread Sergei Zviagintsev
Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/limits.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/ipc/kdbus/limits.h b/ipc/kdbus/limits.h index bd47119cdf1b..5e4d2b5b0a9d 100644 --- a/ipc/kdbus/limits.h +++ b/ipc/kdbus/limits.h @@ -16,9 +16,6 @@ #include -/* maximum size of

[PATCH 11/44] kdbus: Cosmetic fix of kdbus_name_is_valid()

2015-10-08 Thread Sergei Zviagintsev
Initialize `dot' during declaration but not in the for-loop, as it is not used as a loop cursor. Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/names.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ipc/kdbus/names.c b/ipc/kdbus/names.c index 6b31b38ac2ad..4dea83d

[PATCH 15/44] kdbus: Simplify bitwise expression in kdbus_meta_get_mask()

2015-10-08 Thread Sergei Zviagintsev
Replace the expression with more concise and readable equivalent. It can be proven by opening parentheses: r & ~((p | i) & r) == r & (~(p | i) | ~r) == (r & ~(p | i)) | (r & ~r) == r & ~(p | i) == r & ~p & ~i Signed-off-by: Sergei Zviagintsev --- ipc

[PATCH 19/44] kdbus: Drop useless initialization from kdbus_conn_reply()

2015-10-08 Thread Sergei Zviagintsev
`name' is assigned the value at first use by kdbus_pin_dst(). Do not initialize it during declaration. Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/connection.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipc/kdbus/connection.c b/ipc/kdbus/connection.c

[PATCH 18/44] kdbus: Add var initialization to kdbus_conn_entry_insert()

2015-10-08 Thread Sergei Zviagintsev
Assign zero to `ret' in the beginning of function instead of doing it in the end. Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/connection.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ipc/kdbus/connection.c b/ipc/kdbus/connection.c index 4f3cd370ecd9..185ed3b

[PATCH 20/44] kdbus: Drop useless initialization from kdbus_cmd_hello()

2015-10-08 Thread Sergei Zviagintsev
Do not initialize `c' as it is assigned a return value of kdbus_conn_new() at the first use. Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/connection.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipc/kdbus/connection.c b/ipc/kdbus/connection.c index 4b5ed4b

[PATCH 21/44] kdbus: Cleanup tests in kdbus_cmd_send()

2015-10-08 Thread Sergei Zviagintsev
Rearrange tests a little to make them look cleaner. Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/connection.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ipc/kdbus/connection.c b/ipc/kdbus/connection.c index 93da7f539f74..a4d7414ecaea 100644 --- a/ipc/kdbus

[PATCH 23/44] kdbus: Cleanup kdbus_conn_call()

2015-10-08 Thread Sergei Zviagintsev
to zero is unnecessary because kdbus_conn_entry_insert() returns 0 on success. Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/connection.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/ipc/kdbus/connection.c b/ipc/kdbus/connection.c index a4d7414ecaea..db49f282a1bf 100644 ---

[PATCH 25/44] kdbus: Cleanup kdbus_cmd_conn_info()

2015-10-08 Thread Sergei Zviagintsev
- Remove redundant goto. Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/connection.c | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/ipc/kdbus/connection.c b/ipc/kdbus/connection.c index b3c5f20a57d8..6a73ac3f444d 100644 --- a/ipc/kdbus/connection.c +++

[PATCH 26/44] kdbus: Cleanup kdbus_pin_dst()

2015-10-08 Thread Sergei Zviagintsev
- Reduce scope of `owner' var to the block where it is actually used. Use conditional operator to set its value. - Drop initialization of `dst' as it gets value later. - Drop separate exit point as we have only one use case of it. Signed-off-by: Sergei Zviagintsev ---

[PATCH 28/44] kdbus: Cleanup kdbus_queue_entry_new()

2015-10-08 Thread Sergei Zviagintsev
Remove separate exit point as the only error case in the function is when kdbus_staging_emit() fails. Assign a slice to temporary var first to not clear it explicitly on error and to return an error code without `ret' variable. Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/queue.c

[PATCH 31/44] kdbus: Cleanup kdbus_conn_move_messages()

2015-10-08 Thread Sergei Zviagintsev
- Move `r' and `ret' to scopes where they are used. Drop redundant initialization of `ret'. - Initialize `bus' on declaration. - Replace list_for_each_entry_safe() with list_for_each_entry() when iterating over list of replies. - Drop redundant `continue'

[PATCH 34/44] kdbus: Improve kdbus_conn_entry_sync_attach()

2015-10-08 Thread Sergei Zviagintsev
Use goto to handle error paths in conventional way. Use conditional operator instead of `remote_ret' var. Update the comment on waking up remote peer. Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/connection.c | 52 -- 1 file change

[PATCH 30/44] kdbus: Cleanup kdbus_meta_proc_mask()

2015-10-08 Thread Sergei Zviagintsev
inary operation In 'proc < KDBUS_META_PROC_NORMAL' case we firstly do 'wanted &= ~flags' and then 'wanted & flags' in the return statement, which is the same as 'wanted & 0'. Return 0 instead. - Cosmetic cleanup of the r

[PATCH 32/44] kdbus: Remove duplicated code from kdbus_conn_lock2()

2015-10-08 Thread Sergei Zviagintsev
Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/connection.h | 18 +++--- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/ipc/kdbus/connection.h b/ipc/kdbus/connection.h index 679f393d3e68..3b382b604348 100644 --- a/ipc/kdbus/connection.h +++ b/ipc/kdbus/connection.h

[PATCH 36/44] kdbus: Improve kdbus_name_release()

2015-10-08 Thread Sergei Zviagintsev
Use goto to handle error paths in conventional way. Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/names.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/ipc/kdbus/names.c b/ipc/kdbus/names.c index a1c3442f8e53..8e53681d1b7b 100644 --- a/ipc/kdbus

[PATCH 41/44] kdbus: Fix memfd install algorithm

2015-10-08 Thread Sergei Zviagintsev
ee file descriptor for memfd. Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/message.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ipc/kdbus/message.c b/ipc/kdbus/message.c index f2176796390d..0653a085c104 100644 --- a/ipc/kdbus/message.c +++ b/ipc/kdbus/message.c @@ -181,6 +181,7 @@ int

[PATCH 43/44] kdbus: Give up on failed fd allocation

2015-10-08 Thread Sergei Zviagintsev
If we failed to allocate a file descriptor, do not try to do it again on the next iteration. There are few chances that we will have success, and we can simplify the algorithm assuming that valid fd numbers are not mixed with -1 values. Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/message.c

[PATCH 38/44] kdbus: Fix error path in kdbus_user_lookup()

2015-10-08 Thread Sergei Zviagintsev
If idr_alloc() fails, we shouldn't call idr_remove() as latter produces warning when called on non-allocated ids. Split cleanup code into three parts for differrent cleanup scenarios before and after idr_alloc(). Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/domain.c

[PATCH 39/44] kdbus: Cleanup kdbus_user_lookup()

2015-10-08 Thread Sergei Zviagintsev
ain' in error path, which is equivalent but more concise and readable (as we used same vars in the code above). Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/domain.c | 26 -- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/ipc/kdbus

[PATCH 40/44] kdbus: Cleanup kdbus_item_validate_name()

2015-10-08 Thread Sergei Zviagintsev
se and readable. Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/item.c | 26 ++ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/ipc/kdbus/item.c b/ipc/kdbus/item.c index ce78dba03426..e6b6e2ca7e05 100644 --- a/ipc/kdbus/item.c +++ b/ipc/kdbus/item.c @

[PATCH 44/44] kdbus: Cleanup kdbus_gaps_install()

2015-10-08 Thread Sergei Zviagintsev
- Assign `false' to *out_incomplete directly on no-op cases. - Initialize `ret' with zero during declaration instead of doing it in the end of the function. - Initialize `fd' and `memfd' vars during declaration to be more concise. Signed-off-by: Sergei Zviagin

[PATCH 37/44] kdbus: Fix error path in kdbus_meta_proc_collect_cgroup()

2015-10-08 Thread Sergei Zviagintsev
Current code checks return value of task_cgroup_path(), which can be NULL if provided buffer isn't long enough to store path there, but alters mp->valid in case of error, producing inconsistency. Return -ENAMETOOLONG if task_cgroup_path() fails. Signed-off-by: Sergei Zviagintsev --- i

[PATCH 35/44] kdbus: Drop goto from kdbus_queue_entry_link()

2015-10-08 Thread Sergei Zviagintsev
Use conventional if-else logic instead of goto, which makes the function easier to read. Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/queue.c | 32 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/ipc/kdbus/queue.c b/ipc/kdbus/queue.c index

[PATCH 42/44] kdbus: Check if fd is allocated before trying to free it

2015-10-08 Thread Sergei Zviagintsev
Elements of `fds' array were set to -1 in case if we couldn't allocate a fd. Verify that element contains a valid fd number before submitting it to put_unused_fd(). Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/message.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) di

[PATCH 13/44] kdbus: Use list_next_entry() in kdbus_queue_entry_unlink()

2015-10-08 Thread Sergei Zviagintsev
Use list_next_entry() instead of list_first_entry(). Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/queue.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ipc/kdbus/queue.c b/ipc/kdbus/queue.c index f9c44d7bae6d..90e8d16f5967 100644 --- a/ipc/kdbus/queue.c +++ b/ipc

[PATCH 10/44] kdbus: Use conditional operator

2015-10-08 Thread Sergei Zviagintsev
Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/names.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ipc/kdbus/names.c b/ipc/kdbus/names.c index bf44ca3f12b6..6b31b38ac2ad 100644 --- a/ipc/kdbus/names.c +++ b/ipc/kdbus/names.c @@ -438,10 +438,7 @@ static void

[PATCH 14/44] kdbus: Simplify expression in kdbus_get_memfd()

2015-10-08 Thread Sergei Zviagintsev
'(s & m) != m' means that mask 'm' contains some bits which are not set in 's', and this is literally equal to '~s & m'. Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/message.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a

[PATCH 24/44] kdbus: Cleanup kdbus_conn_unicast()

2015-10-08 Thread Sergei Zviagintsev
Do not initialize `name' and `ret' as values are assigned to them at the first use by kdbus_pin_dst(). Simplify handling of kdbus_conn_entry_insert() return value and drop useless goto. Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/connection.c | 10 -- 1 file changed, 4

[PATCH 33/44] kdbus: Improve kdbus_staging_reserve()

2015-10-08 Thread Sergei Zviagintsev
Allow to reserve N elements in row. This eliminates duplicated code. Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/message.c | 22 -- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/ipc/kdbus/message.c b/ipc/kdbus/message.c index e337b1b1024a..f2176796390d

[PATCH 17/44] kdbus: Drop duplicated code from kdbus_pool_slice_alloc()

2015-10-08 Thread Sergei Zviagintsev
Check the value of `ret' instead of keeping separate exit point. Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/pool.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ipc/kdbus/pool.c b/ipc/kdbus/pool.c index cb692a35755b..75a7366baa34 100644 --- a/ipc/kdbus/p

[PATCH 22/44] kdbus: Cleanup error path in kdbus_staging_new_user()

2015-10-08 Thread Sergei Zviagintsev
Replace duplicated cleanup code with jump to exit point. Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/message.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ipc/kdbus/message.c b/ipc/kdbus/message.c index c7ef23d40471..e337b1b1024a 100644 --- a/ipc/kdbus/message.c

[PATCH 08/44] kdbus: Rename var in kdbus_meta_export_caps()

2015-10-08 Thread Sergei Zviagintsev
#x27; name is more consistent with the `owner' var, as it can be read "cred is a member of user_ns or one of its parents" and "cred is the owner of ...". Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/metadata.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deleti

[PATCH 16/44] kdbus: Drop redundant code from kdbus_name_acquire()

2015-10-08 Thread Sergei Zviagintsev
We already reached the end of function at this point, so remove useless goto. Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/names.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/ipc/kdbus/names.c b/ipc/kdbus/names.c index 4dea83defc8e..a1c3442f8e53 100644 --- a/ipc/kdbus/names.c +++ b

[PATCH 29/44] kdbus: Improve tests on incrementing quota

2015-10-08 Thread Sergei Zviagintsev
in `quota->fds + fds' to be safe in the second expression (as fds is size_t, quota->fds is converted to bigger type). Rewrite it in more obvious way. KDBUS_CONN_MAX_FDS_PER_USER is checked at compile time to fill in quota->fds type (there is BUILD_BUG_ON), so no fu

[PATCH 27/44] kdbus: Cleanup kdbus_conn_new()

2015-10-08 Thread Sergei Zviagintsev
!name == (is_activator || is_policy_holder) - Drop `privileged' var which is used only once to set value of conn->privileged. Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/connection.c | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/ipc/kdbus/connection.

[PATCH 12/44] kdbus: Use conventional list macros in __kdbus_pool_slice_release()

2015-10-08 Thread Sergei Zviagintsev
Use list_next_entry() and list_prev_entry(). Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/pool.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ipc/kdbus/pool.c b/ipc/kdbus/pool.c index c26ef963d8d1..cb692a35755b 100644 --- a/ipc/kdbus/pool.c +++ b/ipc/kdbus/pool.c

[PATCH 00/44] kdbus cleanups

2015-10-08 Thread Sergei Zviagintsev
layout of this, split/join, etc if necessary. Thanks, Sergei Sergei Zviagintsev (44): Documentation/kdbus: Document new name registry flags uapi: kdbus.h: Kernel-doc fixes kdbus: Kernel-docs and comments trivial fixes kdbus: Update kernel-doc for struct kdbus_pool kdbus: Add comment on

[PATCH 04/44] kdbus: Update kernel-doc for struct kdbus_pool

2015-10-08 Thread Sergei Zviagintsev
Add words on how free and busy slices trees are sorted. Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/pool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ipc/kdbus/pool.c b/ipc/kdbus/pool.c index 0433e26b777e..84afe96fbc22 100644 --- a/ipc/kdbus/pool.c +++ b/ipc

[PATCH 02/44] uapi: kdbus.h: Kernel-doc fixes

2015-10-08 Thread Sergei Zviagintsev
- Fix typos and spelling errors, use proper case. - struct kdbus_pids: Add PPID to description. - struct kdbus_item: Add missing @pids, @fsd and KDBUS_ITEM_PAYLOAD_OFF. Signed-off-by: Sergei Zviagintsev --- include/uapi/linux/kdbus.h | 43 +++ 1

[PATCH 01/44] Documentation/kdbus: Document new name registry flags

2015-10-08 Thread Sergei Zviagintsev
Add description of KDBUS_NAME_PRIMARY and KDBUS_NAME_ACQUIRED flags which were added in commit 0486b859f05a ("kdbus: inform caller about exact updates on NAME_ACQUIRE"). Signed-off-by: Sergei Zviagintsev --- Documentation/kdbus/kdbus.name.xml | 42 +++-

[PATCH 05/44] kdbus: Add comment on merging free pool slices

2015-10-08 Thread Sergei Zviagintsev
Add comment on why we remove the same slice from free slices tree and then add it back again when merging the slice to be released with previous free slice. Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/pool.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/ipc/kdbus/pool.c b/ipc

Re: [RFC 5/8] kdbus: use LSM hooks in kdbus code

2015-07-09 Thread Sergei Zviagintsev
Hi, On Wed, Jul 08, 2015 at 02:12:03PM +0200, Paul Osmialowski wrote: [...] > > + ret = security_kdbus_bus_alloc(b); > + if (ret) { > + goto exit_unref; > + } checkpatch.pl will complain about this -- To unsubscribe from this list: send the line "unsubscribe linux-kerne

Re: [RFC 4/8] lsm: smack: smack callbacks for kdbus security hooks

2015-07-09 Thread Sergei Zviagintsev
Hi, On Wed, Jul 08, 2015 at 12:25:06PM +0200, Paul Osmialowski wrote: > This adds implementation of three smack callbacks sitting behind kdbus > security hooks as proposed by Karol Lewandowski. > > Originates from: > > git://git.infradead.org/users/pcmoore/selinux (branch: working-kdbus) > commi

Re: [PATCH RFC 0/5] kdbus: minor quota code improvements

2015-07-07 Thread Sergei Zviagintsev
Hi David, On Mon, Jul 06, 2015 at 08:48:26PM +0200, David Herrmann wrote: > Hi > > On Sun, Jun 28, 2015 at 3:17 PM, Sergei Zviagintsev wrote: > > Hi, > > > > Main points here are to use conventional types, rewrite tests in obvious > > way, add couple of new W

Re: [PATCH RFC 5/5] kdbus: improve tests on incrementing quota

2015-07-05 Thread Sergei Zviagintsev
Hi, On Sat, Jul 04, 2015 at 01:42:31PM +0200, David Herrmann wrote: > Hi > > On Thu, Jul 2, 2015 at 3:45 PM, Sergei Zviagintsev wrote: > > Hi David, > > > > Thank you for reviewing and providing comments on these all! I answered > > below. > > >

Re: [PATCH 5/6] kdbus: pin namespaces on HELLO

2015-07-03 Thread Sergei Zviagintsev
Hi, On Thu, Jul 02, 2015 at 10:28:33AM +0200, David Herrmann wrote: > Whenever we send messages to a target connection, all we know about the > target is the 'struct file' associated with the kdbus connection. Hence, > we cannot know which namespaces a receiving process will be in when it > calls

Re: [PATCH 2/6] kdbus: drop redundant KDBUS_MSG_MAX_ITEMS

2015-07-03 Thread Sergei Zviagintsev
Hi, On Thu, Jul 02, 2015 at 10:28:30AM +0200, David Herrmann wrote: > We already limit the size of the message object, there's no reason to add > an arbitrary additional limit on the number of items. We don't do this for > other item-arrays, so lets stop restricting the messages in this way. > >

Re: [PATCH RFC 5/5] kdbus: improve tests on incrementing quota

2015-07-02 Thread Sergei Zviagintsev
Hi Djalal, On Thu, Jul 02, 2015 at 03:13:41PM +0100, Djalal Harouni wrote: [...] > > My journey with this piece of code began from spotting and immediately > > "fixing" the overflow issue :) Then I decided to dig into the > > out-of-tree repo to find the origin of this line. What I found were > >

Re: [PATCH RFC 3/5] kdbus: do explicit overflow check in kdbus_conn_quota_inc()

2015-07-02 Thread Sergei Zviagintsev
Hi, On Thu, Jul 02, 2015 at 10:35:30AM +0200, David Herrmann wrote: > Hi > > On Sun, Jun 28, 2015 at 3:17 PM, Sergei Zviagintsev wrote: > > Replace the use of max() with explicit and obvious overflow check. > > > > Signed-off-by: Sergei Zviagintsev > > --

Re: [PATCH RFC 5/5] kdbus: improve tests on incrementing quota

2015-07-02 Thread Sergei Zviagintsev
Hi David, Thank you for reviewing and providing comments on these all! I answered below. On Thu, Jul 02, 2015 at 10:50:47AM +0200, David Herrmann wrote: > Hi > > On Sun, Jun 28, 2015 at 3:17 PM, Sergei Zviagintsev wrote: > > 1) Rewrite > > > > quota

Re: [PATCH RFC 4/5] kdbus: handle WARN_ON cases properly when decrementing quota

2015-07-02 Thread Sergei Zviagintsev
Hi, On Thu, Jul 02, 2015 at 10:37:05AM +0200, David Herrmann wrote: > Hi > > On Sun, Jun 28, 2015 at 3:17 PM, Sergei Zviagintsev wrote: > > If we spotted inconsistency, fix it by setting values to zero. > > Why? > > I prefer doing nothing and just bailing out on pr

Re: [PATCH RFC 1/5] kdbus: fix typos in kdbus_conn_quota_inc()

2015-07-02 Thread Sergei Zviagintsev
Hi, On Thu, Jul 02, 2015 at 10:31:48AM +0200, David Herrmann wrote: > Hi > > On Sun, Jun 28, 2015 at 3:17 PM, Sergei Zviagintsev wrote: > > Signed-off-by: Sergei Zviagintsev > > --- > > ipc/kdbus/connection.c | 4 ++-- > > 1 file changed, 2 insertions(+),

Re: [PATCH RFC v2 3/3] misc: Add w2g0004 gps receiver driver

2015-06-30 Thread Sergei Zviagintsev
Hi, I left some comments below. On Sun, Jun 28, 2015 at 09:46:26PM +0200, Marek Belisko wrote: > From: "H. Nikolaus Schaller" > > Add driver for Wi2Wi w2g004 GPS module connected through uart. Use uart > slave + notification hooks to glue with tty. > > Signed-off-by: H. Nikolaus Schaller > S

Re: [PATCH RFC v2 1/3] tty: serial core: provide method to search uart by phandle

2015-06-30 Thread Sergei Zviagintsev
Hi, On Mon, Jun 29, 2015 at 06:44:23PM +0200, Dr. H. Nikolaus Schaller wrote: [...] > >> + list_for_each_entry(uart, &uart_list, head) { > >> + if (node != uart->dev->of_node) > >> + continue; > >> + > >> + return uart; > > > > We can easily save three lines he

Re: [PATCH RFC v2 2/3] tty: serial_core: Add hooks for uart slave drivers

2015-06-28 Thread Sergei Zviagintsev
Hi, Some minor comments below. On Sun, Jun 28, 2015 at 09:46:25PM +0200, Marek Belisko wrote: > From: "H. Nikolaus Schaller" > > 1. allow drivers to get notified in mctrl changes > 2. allow drivers to get notified on rx data (indicating to the driver that >the connected chip is active) > >

Re: [PATCH RFC v2 1/3] tty: serial core: provide method to search uart by phandle

2015-06-28 Thread Sergei Zviagintsev
Hi, Some comments below. On Sun, Jun 28, 2015 at 09:46:24PM +0200, Marek Belisko wrote: > From: "H. Nikolaus Schaller" > > 1. add registered uart_ports to a search list > 2. provide a function to search an uart_port by phandle. This copies the >mechanism how devm_usb_get_phy_by_phandle() wo

[PATCH RFC 0/5] kdbus: minor quota code improvements

2015-06-28 Thread Sergei Zviagintsev
these. Sergei Zviagintsev (5): kdbus: fix typos in kdbus_conn_quota_inc() kdbus: use standard kernel types in struct kdbus_quota kdbus: do explicit overflow check in kdbus_conn_quota_inc() kdbus: handle WARN_ON cases properly when decrementing quota kdbus: improve tests on incrementing quota

[PATCH RFC 5/5] kdbus: improve tests on incrementing quota

2015-06-28 Thread Sergei Zviagintsev
overflow in `quota->fds + fds' to be safe in the second expression (as fds is size_t, quota->fds is converted to bigger type). Rewrite it in more obvious way. KDBUS_CONN_MAX_FDS_PER_USER is checked at compile time to fill in quota->fds type (there is BUILD_BUG_ON), so

[PATCH RFC 2/5] kdbus: use standard kernel types in struct kdbus_quota

2015-06-28 Thread Sergei Zviagintsev
uint{8,16,32}_t -> u{8,16,32} Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/connection.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ipc/kdbus/connection.c b/ipc/kdbus/connection.c index df072487e23c..af044f93c14f 100644 --- a/ipc/kdbus/connection.c +++ b/

[PATCH RFC 3/5] kdbus: do explicit overflow check in kdbus_conn_quota_inc()

2015-06-28 Thread Sergei Zviagintsev
Replace the use of max() with explicit and obvious overflow check. Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/connection.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ipc/kdbus/connection.c b/ipc/kdbus/connection.c index af044f93c14f..1d44e280eff0 100644 --- a

[PATCH RFC 1/5] kdbus: fix typos in kdbus_conn_quota_inc()

2015-06-28 Thread Sergei Zviagintsev
Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/connection.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ipc/kdbus/connection.c b/ipc/kdbus/connection.c index 9993753d11de..df072487e23c 100644 --- a/ipc/kdbus/connection.c +++ b/ipc/kdbus/connection.c @@ -646,7 +646,7

[PATCH RFC 4/5] kdbus: handle WARN_ON cases properly when decrementing quota

2015-06-28 Thread Sergei Zviagintsev
If we spotted inconsistency, fix it by setting values to zero. Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/connection.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ipc/kdbus/connection.c b/ipc/kdbus/connection.c index 1d44e280eff0..12e32de310f5 100644

Re: [PATCH] iio: light: Add support for TXC PA12 als and proximity sensor

2015-06-25 Thread Sergei Zviagintsev
Hi, I just was walking around and decided to look inside this driver :) I left some comments below. On Fri, Jun 26, 2015 at 01:29:22PM +0300, Adriana Reus wrote: ^^^ Your message came from future. > Add support for TXC PA12203001 als and proximity sensor. > Support for raw illuminance and pro

[PATCH 3/3] kdbus: optimize if statements in kdbus_conn_disconnect()

2015-06-17 Thread Sergei Zviagintsev
if (r->sync) branch and code after it both call kdbus_reply_unlink(). Rewrite them as if-else to eliminate code duplication and make algorithm more obvious. Convert outer if statement to use continue in order to reduce indentation and make things easier to read. Signed-off-by: Sergei Zviagint

[PATCH 2/3] kdbus: optimize error path in kdbus_reply_new()

2015-06-17 Thread Sergei Zviagintsev
Move cleanup code to separate location as it never executes on normal flow. This removes extra if-block and the need to initialize `ret'. Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/reply.c | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ipc/kdbus/repl

[PATCH 1/3] kdbus: kdbus_reply_find(): return on found entry

2015-06-17 Thread Sergei Zviagintsev
Return found entry immediately instead of assigning it to additional variable and breaking the loop. It's simpler to read, the same way is used in kdbus_conn_has_name(), for example. Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/reply.c | 10 -- 1 file changed, 4 insertions(

[PATCH 0/3] kdbus: minor readability improvements

2015-06-17 Thread Sergei Zviagintsev
Little improvements to make things easier to read. Sergei Zviagintsev (3): kdbus: kdbus_reply_find(): return on found entry kdbus: optimize error path in kdbus_reply_new() kdbus: optimize if statements in kdbus_conn_disconnect() ipc/kdbus/connection.c | 15 +++ ipc/kdbus

Re: [PATCH] selftests/kdbus: handle cap_get_proc() error properly

2015-06-17 Thread Sergei Zviagintsev
Hi Greg, On Wed, Jun 17, 2015 at 07:37:20AM -0700, Greg Kroah-Hartman wrote: > You sent 5 patches, yet no hints as to what order they should be applied > in :( > > Please resend in a patch series that is properly threaded so we can > handle this correctly. Thank you for feedback! I've resent ser

[PATCH v2 1/5] selftests/kdbus: handle cap_get_proc() error properly

2015-06-17 Thread Sergei Zviagintsev
Fix typo in checking error value of cap_get_proc(): cap -> caps Signed-off-by: Sergei Zviagintsev --- tools/testing/selftests/kdbus/kdbus-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/kdbus/kdbus-util.c b/tools/testing/selftests/kdbus/kd

[PATCH v2 5/5] selftests/kdbus: fix error paths in __kdbus_msg_send()

2015-06-17 Thread Sergei Zviagintsev
Handle errors properly, free allocated resources. Signed-off-by: Sergei Zviagintsev --- tools/testing/selftests/kdbus/kdbus-util.c | 31 ++ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/tools/testing/selftests/kdbus/kdbus-util.c b/tools/testing

[PATCH v2 4/5] selftests/kdbus: drop duplicated code from __kdbus_msg_send()

2015-06-17 Thread Sergei Zviagintsev
Set value of `size' in one step instead of four. Signed-off-by: Sergei Zviagintsev --- tools/testing/selftests/kdbus/kdbus-util.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/testing/selftests/kdbus/kdbus-util.c b/tools/testing/selftests/kdbus/kdbus-u

[PATCH v2 3/5] selftests/kdbus: remove useless initializations from kdbus_clone_userns_test()

2015-06-17 Thread Sergei Zviagintsev
Do not initialize efd, unpriv_conn_id, userns_conn_id and monitor. These vars are assigned to values later in code while initial values are never used. Signed-off-by: Sergei Zviagintsev --- tools/testing/selftests/kdbus/test-metadata-ns.c | 9 +++-- 1 file changed, 3 insertions(+), 6

[PATCH v2 2/5] selftests/kdbus: drop useless assignment

2015-06-17 Thread Sergei Zviagintsev
Assign returned file descriptor directly to `fd', without intermediate `ret' variable. Signed-off-by: Sergei Zviagintsev --- tools/testing/selftests/kdbus/kdbus-util.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/kdbus/kdbus-util.

[PATCH v2 0/5] selftests/kdbus: small fixes

2015-06-17 Thread Sergei Zviagintsev
...@s15v.net http://lkml.kernel.org/g/1434550697-24785-3-git-send-email-ser...@s15v.net http://lkml.kernel.org/g/1434550697-24785-4-git-send-email-ser...@s15v.net http://lkml.kernel.org/g/1434550697-24785-5-git-send-email-ser...@s15v.net Sergei Zviagintsev (5): selftests/kdbus: handle cap_get_proc

[PATCH] selftests/kdbus: fix error paths in __kdbus_msg_send()

2015-06-17 Thread Sergei Zviagintsev
Handle errors properly, free allocated resources. Signed-off-by: Sergei Zviagintsev --- tools/testing/selftests/kdbus/kdbus-util.c | 31 ++ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/tools/testing/selftests/kdbus/kdbus-util.c b/tools/testing

[PATCH] selftests/kdbus: drop duplicated code from __kdbus_msg_send()

2015-06-17 Thread Sergei Zviagintsev
Set value of `size' in one step instead of four. Signed-off-by: Sergei Zviagintsev --- tools/testing/selftests/kdbus/kdbus-util.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/testing/selftests/kdbus/kdbus-util.c b/tools/testing/selftests/kdbus/kdbus-u

[PATCH] selftests/kdbus: remove useless initializations from kdbus_clone_userns_test()

2015-06-17 Thread Sergei Zviagintsev
Do not initialize efd, unpriv_conn_id, userns_conn_id and monitor. These vars are assigned to values later in code while initial values are never used. Signed-off-by: Sergei Zviagintsev --- tools/testing/selftests/kdbus/test-metadata-ns.c | 9 +++-- 1 file changed, 3 insertions(+), 6

[PATCH] selftests/kdbus: handle cap_get_proc() error properly

2015-06-17 Thread Sergei Zviagintsev
Fix typo in checking error value of cap_get_proc(): cap -> caps Signed-off-by: Sergei Zviagintsev --- tools/testing/selftests/kdbus/kdbus-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/kdbus/kdbus-util.c b/tools/testing/selftests/kdbus/kd

[PATCH] selftests/kdbus: drop useless assignment

2015-06-17 Thread Sergei Zviagintsev
Assign returned file descriptor directly to `fd', without intermediate `ret' variable. Signed-off-by: Sergei Zviagintsev --- tools/testing/selftests/kdbus/kdbus-util.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/kdbus/kdbus-util.

Re: [PATCH v2 00/10] kdbus: macros fixes

2015-06-10 Thread Sergei Zviagintsev
Hi On Wed, Jun 10, 2015 at 04:13:49PM +0200, David Herrmann wrote: > Next time, please merge most of these changes to reduce the number of > patches and review-overhead. But looks all good to me, much > appreciated. Thank you for response, I will keep that in mind. -- To unsubscribe from this lis

[PATCH v2 02/10] kdbus: use parentheses uniformly in KDBUS_ITEMS_FOREACH macro

2015-06-09 Thread Sergei Zviagintsev
Enclose all arguments into parentheses to stay consistent across the whole macro. Signed-off-by: Sergei Zviagintsev --- ipc/kdbus/item.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ipc/kdbus/item.h b/ipc/kdbus/item.h index 32909e2e7954..bca63b4e6e80 100644 --- a/ipc

[PATCH v2 10/10] samples/kdbus: use parentheses uniformly in KDBUS_FOREACH macro

2015-06-09 Thread Sergei Zviagintsev
Enclose all arguments into parentheses to stay consistent across the whole macro. Signed-off-by: Sergei Zviagintsev --- samples/kdbus/kdbus-api.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/kdbus/kdbus-api.h b/samples/kdbus/kdbus-api.h index fab873b89d97

[PATCH v2 06/10] selftests/kdbus: fix precedence issues in macros

2015-06-09 Thread Sergei Zviagintsev
e, missing parentheses around `clone_ret' when using indirection operator. Use parentheses properly to guarantee right precedence. Signed-off-by: Sergei Zviagintsev --- tools/testing/selftests/kdbus/kdbus-util.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/te

  1   2   >