Skip to contentSkip to conversation

Security: key: keyring: fix some code style issues

PATCH James Kosin 2 participants 4 messages Mar 9, 2010 3 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 34 lines · Chihau Chau

From: Chihau Chau <[email protected]>

This fixes to include <linux/uaccess.h> instead <asm/uaccess.h> and some code style issues like to put a else sentence below close brace '}' and to replace a tab instead of some space characters.

---
 security/keys/keyring.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
security/keys/keyring.c +2 -2
index e814d21..840be66 100644
@@ -17,7 +17,7 @@
 #include <linux/seq_file.h>
 #include <linux/err.h>
 #include <keys/keyring-type.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "internal.h"
 
 /*
@@ -306,7 +306,7 @@ key_ref_t keyring_search_aux(key_ref_t keyring_ref,
 	key_check(keyring);
 
 	/* top keyring must have search permission to begin the search */
-        err = key_task_permission(keyring_ref, cred, KEY_SEARCH);
+	err = key_task_permission(keyring_ref, cred, KEY_SEARCH);
 	if (err < 0) {
 		key_ref = ERR_PTR(err);
 		goto error;

security/keys/keyring.c int __key_link(struct key *keyring, struct key *key) · line 781

Quoted 9 lines
security/keys/keyring.c +1 -2
@@ -775,8 +775,7 @@ int __key_link(struct key *keyring, struct key *key)
 		smp_wmb();
 		klist->nkeys++;
 		smp_wmb();
-	}
-	else {
+	} else {
 		/* grow the key list */
 		max = 4;
 		if (klist)

Chau,

What happened to the other part of the patch to fix the "} else {" above where you had tried to remove the {} ?

James

#2 lore raw

You said me that it may introduce a serious BUG later so I have undone this change.

Regards.

2010/3/9 James Kosin <[email protected]>:

Quoted 57 lines · Chihau Chau
Quoted 34 lines

From: Chihau Chau <[email protected]>

This fixes to include <linux/uaccess.h> instead <asm/uaccess.h> and some code style issues like to put a else sentence below close brace '}' and to replace a tab instead of some space characters.

---
 security/keys/keyring.c |    7 +++----

 1 files changed, 3 insertions(+), 4 deletions(-)
security/keys/keyring.c +2 -2
index e814d21..840be66 100644
@@ -17,7 +17,7 @@
  #include <linux/seq_file.h>
  #include <linux/err.h>
  #include <keys/keyring-type.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
  #include "internal.h"
 
  /*
@@ -306,7 +306,7 @@ key_ref_t keyring_search_aux(key_ref_t keyring_ref,
       key_check(keyring);
 
       /* top keyring must have search permission to begin the search */
-        err = key_task_permission(keyring_ref, cred, KEY_SEARCH);
+     err = key_task_permission(keyring_ref, cred, KEY_SEARCH);
       if (err < 0) {
               key_ref = ERR_PTR(err);
               goto error;

security/keys/keyring.c int __key_link(struct key *keyring, struct key *key) · line 781

Quoted 9 lines
security/keys/keyring.c +1 -2
@@ -775,8 +775,7 @@ int __key_link(struct key *keyring, struct key *key)
               smp_wmb();
               klist->nkeys++;
               smp_wmb();
-     }
-     else {
+     } else {
               /* grow the key list */
               max = 4;
               if (klist)

Chau,

What happened to the other part of the patch to fix the "} else {" above where you had tried to remove the {} ?

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

Signature · 1 line
Chihau Chau

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

Hi James

2010/3/9 James Kosin <[email protected]>:

Quoted 10 lines

Chau,

I was talking about removing the braces.  The code you pointed to still had the style issue of this:
    }
    else {

Where you changed the one below to be:
    } else {

This is done in the last patch

Quoted 1 line

I'm okay with making a change like this.  Only don't remove the {} braces.

Yes in the last patch I don't have remove the braces {}

Now, It's everything OK? I will appreciate your councils.

Regards.

Quoted 77 lines

James

On 3/9/2010 12:01 PM, Chihau Chau wrote:

You said me that it may introduce a serious BUG later so I have undone this change.

Regards.

2010/3/9 James Kosin <[email protected]>:

On 3/8/2010 6:20 PM, Chihau Chau wrote:

From: Chihau Chau <[email protected]>

This fixes to include <linux/uaccess.h> instead <asm/uaccess.h> and some code style issues like to put a else sentence below close brace '}' and to replace a tab instead of some space characters.

---
 security/keys/keyring.c |    7 +++----

 1 files changed, 3 insertions(+), 4 deletions(-)
security/keys/keyring.c +3 -4
index e814d21..840be66 100644
@@ -17,7 +17,7 @@
  #include <linux/seq_file.h>
  #include <linux/err.h>
  #include <keys/keyring-type.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
  #include "internal.h"
 
  /*
@@ -306,7 +306,7 @@ key_ref_t keyring_search_aux(key_ref_t keyring_ref,
       key_check(keyring);
 
       /* top keyring must have search permission to begin the search */
-        err = key_task_permission(keyring_ref, cred, KEY_SEARCH);
+     err = key_task_permission(keyring_ref, cred, KEY_SEARCH);
       if (err < 0) {
               key_ref = ERR_PTR(err);
               goto error;
@@ -775,8 +775,7 @@ int __key_link(struct key *keyring, struct key *key)
               smp_wmb();
               klist->nkeys++;
               smp_wmb();
-     }
-     else {
+     } else {
               /* grow the key list */
               max = 4;
               if (klist)

Chau,

What happened to the other part of the patch to fix the "} else {" above where you had tried to remove the {} ?

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

Signature · 1 line
Chihau Chau

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

Now I understand. Sorry for my little confusion.

I am making a new patch.

Thanks!

2010/3/9 James Kosin <[email protected]>:

Quoted 75 lines · Chihau Chau

Chau,

Below is your original patch set.

From: Chihau Chau <[email protected]>

This fixes some code style issues like to include <linux/uaccess.h> instead <asm/uaccess.h> and to remove some innecessary braces.

---
 security/keys/keyring.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)
security/keys/keyring.c +3 -5
index e814d21..5a44965 100644
@@ -17,7 +17,7 @@
 #include <linux/seq_file.h>
 #include <linux/err.h>
 #include <keys/keyring-type.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "internal.h"
 
 /*
@@ -170,12 +170,10 @@ static void keyring_describe(const struct key
 *keyring, struct seq_file *m)
 {
 	struct keyring_list *klist;
 
-	if (keyring->description) {
+	if (keyring->description)
 		seq_puts(m, keyring->description);
-	}
-	else {
+	else
 		seq_puts(m, "[anon]");
-	}
 
 

Here is where I said NOT to remove the braces.  However you can see the style of the if() {} else {} blocks is not the same as below where you point to the style of the statements as to the reason for the change.

security/keys/keyring.c +1 -2
 	rcu_read_lock();
 	klist = rcu_dereference(keyring->payload.subscriptions);
@@ -775,8 +773,7 @@ int __key_link(struct key *keyring, struct key *key)
 		smp_wmb();
 		klist->nkeys++;
 		smp_wmb();
-	}
-	else {
+	} else {
 		/* grow the key list */
 		max = 4;
 

See HERE.

if (klist)
--
1.5.6.3

One of these is wrong.  Check the coding style document as to which is correct.

Sorry to be so critical.

Regards,
James K.

Signature · 1 line
Chihau Chau