]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 21 Apr 2008 23:01:40 +0000 (16:01 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 21 Apr 2008 23:01:40 +0000 (16:01 -0700)
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/selinux-2.6:
  SELinux: one little, two little, three little whitespaces, the avc.c saga.
  SELinux: cleanup on isle selinuxfs.c
  changing whitespace for fun and profit: policydb.c
  SELinux: whitespace and formating fixes for hooks.c
  SELinux: clean up printks
  SELinux: sidtab.c whitespace, syntax, and static declaraction cleanups
  SELinux: services.c whitespace, syntax, and static declaraction cleanups
  SELinux: mls.c whitespace, syntax, and static declaraction cleanups
  SELinux: hashtab.c whitespace, syntax, and static declaraction cleanups
  SELinux: ebitmap.c whitespace, syntax, and static declaraction cleanups
  SELinux: conditional.c whitespace, syntax, and static declaraction cleanups
  SELinux: avtab.c whitespace, syntax, and static declaraction cleanups
  SELinux: xfrm.c whitespace, syntax, and static declaraction cleanups
  SELinux: nlmsgtab.c whitespace, syntax, and static declaraction cleanups
  SELinux: netnode.c whitespace, syntax, and static declaraction cleanups
  SELinux: netlink.c whitespace, syntax, and static declaraction cleanups
  SELinux: netlabel.c whitespace, syntax, and static declaraction cleanups
  SELinux: netif.c whitespace, syntax, and static declaraction cleanups

1  2 
security/selinux/selinuxfs.c
security/selinux/ss/conditional.c
security/selinux/xfrm.c

index 7b681692be4793db8723a34b8474cde78156d7c7,893b3db0bad2cf40062dd91f7441a09ce349a4ff..ac1ccc13a704cfaffc87a334a03388bf7f0a2d45
@@@ -1,16 -1,16 +1,16 @@@
  /* Updated: Karl MacMillan <kmacmillan@tresys.com>
   *
-  *    Added conditional policy language extensions
+  *    Added conditional policy language extensions
   *
   *  Updated: Hewlett-Packard <paul.moore@hp.com>
   *
-  *      Added support for the policy capability bitmap
+  *    Added support for the policy capability bitmap
   *
   * Copyright (C) 2007 Hewlett-Packard Development Company, L.P.
   * Copyright (C) 2003 - 2004 Tresys Technology, LLC
   * Copyright (C) 2004 Red Hat, Inc., James Morris <jmorris@redhat.com>
   *    This program is free software; you can redistribute it and/or modify
-  *    it under the terms of the GNU General Public License as published by
+  *    it under the terms of the GNU General Public License as published by
   *    the Free Software Foundation, version 2.
   */
  
@@@ -28,6 -28,7 +28,6 @@@
  #include <linux/percpu.h>
  #include <linux/audit.h>
  #include <asm/uaccess.h>
 -#include <asm/semaphore.h>
  
  /* selinuxfs pseudo filesystem for exporting the security policy API.
     Based on the proc code and the fs/nfsd/nfsctl.c code. */
@@@ -57,14 -58,14 +57,14 @@@ int selinux_compat_net = SELINUX_COMPAT
  
  static int __init checkreqprot_setup(char *str)
  {
-       selinux_checkreqprot = simple_strtoul(str,NULL,0) ? 1 : 0;
+       selinux_checkreqprot = simple_strtoul(str, NULL, 0) ? 1 : 0;
        return 1;
  }
  __setup("checkreqprot=", checkreqprot_setup);
  
  static int __init selinux_compat_net_setup(char *str)
  {
-       selinux_compat_net = simple_strtoul(str,NULL,0) ? 1 : 0;
+       selinux_compat_net = simple_strtoul(str, NULL, 0) ? 1 : 0;
        return 1;
  }
  __setup("selinux_compat_net=", selinux_compat_net_setup);
  static DEFINE_MUTEX(sel_mutex);
  
  /* global data for booleans */
- static struct dentry *bool_dir = NULL;
- static int bool_num = 0;
+ static struct dentry *bool_dir;
+ static int bool_num;
  static char **bool_pending_names;
- static int *bool_pending_values = NULL;
+ static int *bool_pending_values;
  
  /* global data for classes */
- static struct dentry *class_dir = NULL;
+ static struct dentry *class_dir;
  static unsigned long last_class_ino;
  
  /* global data for policy capabilities */
- static struct dentry *policycap_dir = NULL;
+ static struct dentry *policycap_dir;
  
  extern void selnl_notify_setenforce(int val);
  
@@@ -142,7 -143,7 +142,7 @@@ static ssize_t sel_read_enforce(struct 
  }
  
  #ifdef CONFIG_SECURITY_SELINUX_DEVELOP
- static ssize_t sel_write_enforce(struct file * file, const char __user * buf,
+ static ssize_t sel_write_enforce(struct file *file, const char __user *buf,
                                 size_t count, loff_t *ppos)
  
  {
                /* No partial writes. */
                return -EINVAL;
        }
-       page = (char*)get_zeroed_page(GFP_KERNEL);
+       page = (char *)get_zeroed_page(GFP_KERNEL);
        if (!page)
                return -ENOMEM;
        length = -EFAULT;
@@@ -213,7 -214,7 +213,7 @@@ static const struct file_operations sel
  };
  
  #ifdef CONFIG_SECURITY_SELINUX_DISABLE
- static ssize_t sel_write_disable(struct file * file, const char __user * buf,
+ static ssize_t sel_write_disable(struct file *file, const char __user *buf,
                                 size_t count, loff_t *ppos)
  
  {
                /* No partial writes. */
                return -EINVAL;
        }
-       page = (char*)get_zeroed_page(GFP_KERNEL);
+       page = (char *)get_zeroed_page(GFP_KERNEL);
        if (!page)
                return -ENOMEM;
        length = -EFAULT;
@@@ -263,7 -264,7 +263,7 @@@ static const struct file_operations sel
  };
  
  static ssize_t sel_read_policyvers(struct file *filp, char __user *buf,
-                                    size_t count, loff_t *ppos)
+                                  size_t count, loff_t *ppos)
  {
        char tmpbuf[TMPBUFLEN];
        ssize_t length;
@@@ -299,7 -300,7 +299,7 @@@ static const struct file_operations sel
        .read           = sel_read_mls,
  };
  
- static ssize_t sel_write_load(struct file * file, const char __user * buf,
+ static ssize_t sel_write_load(struct file *file, const char __user *buf,
                              size_t count, loff_t *ppos)
  
  {
@@@ -371,7 -372,7 +371,7 @@@ static const struct file_operations sel
        .write          = sel_write_load,
  };
  
- static ssize_t sel_write_context(struct file * file, char *buf, size_t size)
+ static ssize_t sel_write_context(struct file *file, char *buf, size_t size)
  {
        char *canon;
        u32 sid, len;
                return length;
  
        if (len > SIMPLE_TRANSACTION_LIMIT) {
-               printk(KERN_ERR "%s:  context size (%u) exceeds payload "
-                      "max\n", __func__, len);
+               printk(KERN_ERR "SELinux: %s:  context size (%u) exceeds "
+                       "payload max\n", __func__, len);
                length = -ERANGE;
                goto out;
        }
@@@ -413,7 -414,7 +413,7 @@@ static ssize_t sel_read_checkreqprot(st
        return simple_read_from_buffer(buf, count, ppos, tmpbuf, length);
  }
  
- static ssize_t sel_write_checkreqprot(struct file * file, const char __user * buf,
+ static ssize_t sel_write_checkreqprot(struct file *file, const char __user *buf,
                                      size_t count, loff_t *ppos)
  {
        char *page;
                /* No partial writes. */
                return -EINVAL;
        }
-       page = (char*)get_zeroed_page(GFP_KERNEL);
+       page = (char *)get_zeroed_page(GFP_KERNEL);
        if (!page)
                return -ENOMEM;
        length = -EFAULT;
@@@ -462,7 -463,7 +462,7 @@@ static ssize_t sel_read_compat_net(stru
        return simple_read_from_buffer(buf, count, ppos, tmpbuf, length);
  }
  
- static ssize_t sel_write_compat_net(struct file * file, const char __user * buf,
+ static ssize_t sel_write_compat_net(struct file *file, const char __user *buf,
                                    size_t count, loff_t *ppos)
  {
        char *page;
                /* No partial writes. */
                return -EINVAL;
        }
-       page = (char*)get_zeroed_page(GFP_KERNEL);
+       page = (char *)get_zeroed_page(GFP_KERNEL);
        if (!page)
                return -ENOMEM;
        length = -EFAULT;
@@@ -504,11 -505,11 +504,11 @@@ static const struct file_operations sel
  /*
   * Remaining nodes use transaction based IO methods like nfsd/nfsctl.c
   */
- static ssize_t sel_write_access(struct file * file, char *buf, size_t size);
- static ssize_t sel_write_create(struct file * file, char *buf, size_t size);
- static ssize_t sel_write_relabel(struct file * file, char *buf, size_t size);
- static ssize_t sel_write_user(struct file * file, char *buf, size_t size);
- static ssize_t sel_write_member(struct file * file, char *buf, size_t size);
+ static ssize_t sel_write_access(struct file *file, char *buf, size_t size);
+ static ssize_t sel_write_create(struct file *file, char *buf, size_t size);
+ static ssize_t sel_write_relabel(struct file *file, char *buf, size_t size);
+ static ssize_t sel_write_user(struct file *file, char *buf, size_t size);
+ static ssize_t sel_write_member(struct file *file, char *buf, size_t size);
  
  static ssize_t (*write_op[])(struct file *, char *, size_t) = {
        [SEL_ACCESS] = sel_write_access,
  
  static ssize_t selinux_transaction_write(struct file *file, const char __user *buf, size_t size, loff_t *pos)
  {
-       ino_t ino =  file->f_path.dentry->d_inode->i_ino;
+       ino_t ino = file->f_path.dentry->d_inode->i_ino;
        char *data;
        ssize_t rv;
  
        if (IS_ERR(data))
                return PTR_ERR(data);
  
-       rv =  write_op[ino](file, data, size);
-       if (rv>0) {
+       rv = write_op[ino](file, data, size);
+       if (rv > 0) {
                simple_transaction_set(file, rv);
                rv = size;
        }
@@@ -552,7 -553,7 +552,7 @@@ static const struct file_operations tra
   * and the length returned.  Otherwise return 0 or and -error.
   */
  
- static ssize_t sel_write_access(struct file * file, char *buf, size_t size)
+ static ssize_t sel_write_access(struct file *file, char *buf, size_t size)
  {
        char *scon, *tcon;
        u32 ssid, tsid;
@@@ -601,7 -602,7 +601,7 @@@ out
        return length;
  }
  
- static ssize_t sel_write_create(struct file * file, char *buf, size_t size)
+ static ssize_t sel_write_create(struct file *file, char *buf, size_t size)
  {
        char *scon, *tcon;
        u32 ssid, tsid, newsid;
                goto out2;
  
        if (len > SIMPLE_TRANSACTION_LIMIT) {
-               printk(KERN_ERR "%s:  context size (%u) exceeds payload "
-                      "max\n", __func__, len);
+               printk(KERN_ERR "SELinux: %s:  context size (%u) exceeds "
+                       "payload max\n", __func__, len);
                length = -ERANGE;
                goto out3;
        }
@@@ -660,7 -661,7 +660,7 @@@ out
        return length;
  }
  
- static ssize_t sel_write_relabel(struct file * file, char *buf, size_t size)
+ static ssize_t sel_write_relabel(struct file *file, char *buf, size_t size)
  {
        char *scon, *tcon;
        u32 ssid, tsid, newsid;
@@@ -717,7 -718,7 +717,7 @@@ out
        return length;
  }
  
- static ssize_t sel_write_user(struct file * file, char *buf, size_t size)
+ static ssize_t sel_write_user(struct file *file, char *buf, size_t size)
  {
        char *con, *user, *ptr;
        u32 sid, *sids;
@@@ -778,7 -779,7 +778,7 @@@ out
        return length;
  }
  
- static ssize_t sel_write_member(struct file * file, char *buf, size_t size)
+ static ssize_t sel_write_member(struct file *file, char *buf, size_t size)
  {
        char *scon, *tcon;
        u32 ssid, tsid, newsid;
                goto out2;
  
        if (len > SIMPLE_TRANSACTION_LIMIT) {
-               printk(KERN_ERR "%s:  context size (%u) exceeds payload "
-                      "max\n", __func__, len);
+               printk(KERN_ERR "SELinux: %s:  context size (%u) exceeds "
+                       "payload max\n", __func__, len);
                length = -ERANGE;
                goto out3;
        }
@@@ -872,7 -873,8 +872,8 @@@ static ssize_t sel_read_bool(struct fil
                ret = -EINVAL;
                goto out;
        }
-       if (!(page = (char*)get_zeroed_page(GFP_KERNEL))) {
+       page = (char *)get_zeroed_page(GFP_KERNEL);
+       if (!page) {
                ret = -ENOMEM;
                goto out;
        }
@@@ -923,7 -925,7 +924,7 @@@ static ssize_t sel_write_bool(struct fi
                length = -EINVAL;
                goto out;
        }
-       page = (char*)get_zeroed_page(GFP_KERNEL);
+       page = (char *)get_zeroed_page(GFP_KERNEL);
        if (!page) {
                length = -ENOMEM;
                goto out;
@@@ -951,8 -953,8 +952,8 @@@ out
  }
  
  static const struct file_operations sel_bool_ops = {
-       .read           = sel_read_bool,
-       .write          = sel_write_bool,
+       .read           = sel_read_bool,
+       .write          = sel_write_bool,
  };
  
  static ssize_t sel_commit_bools_write(struct file *filep,
                /* No partial writes. */
                goto out;
        }
-       page = (char*)get_zeroed_page(GFP_KERNEL);
+       page = (char *)get_zeroed_page(GFP_KERNEL);
        if (!page) {
                length = -ENOMEM;
                goto out;
        if (sscanf(page, "%d", &new_value) != 1)
                goto out;
  
-       if (new_value && bool_pending_values) {
+       if (new_value && bool_pending_values)
                security_set_bools(bool_num, bool_pending_values);
-       }
  
        length = count;
  
@@@ -1005,7 -1006,7 +1005,7 @@@ out
  }
  
  static const struct file_operations sel_commit_bools_ops = {
-       .write          = sel_commit_bools_write,
+       .write          = sel_commit_bools_write,
  };
  
  static void sel_remove_entries(struct dentry *de)
@@@ -1055,7 -1056,8 +1055,8 @@@ static int sel_make_bools(void
  
        sel_remove_entries(dir);
  
-       if (!(page = (char*)get_zeroed_page(GFP_KERNEL)))
+       page = (char *)get_zeroed_page(GFP_KERNEL);
+       if (!page)
                return -ENOMEM;
  
        ret = security_get_bools(&num, &names, &values);
                        ret = -ENAMETOOLONG;
                        goto err;
                }
-               isec = (struct inode_security_struct*)inode->i_security;
-               if ((ret = security_genfs_sid("selinuxfs", page, SECCLASS_FILE, &sid)))
+               isec = (struct inode_security_struct *)inode->i_security;
+               ret = security_genfs_sid("selinuxfs", page, SECCLASS_FILE, &sid);
+               if (ret)
                        goto err;
                isec->sid = sid;
                isec->initialized = 1;
@@@ -1111,7 -1114,7 +1113,7 @@@ err
  
  #define NULL_FILE_NAME "null"
  
- struct dentry *selinux_null = NULL;
+ struct dentry *selinux_null;
  
  static ssize_t sel_read_avc_cache_threshold(struct file *filp, char __user *buf,
                                            size_t count, loff_t *ppos)
        return simple_read_from_buffer(buf, count, ppos, tmpbuf, length);
  }
  
- static ssize_t sel_write_avc_cache_threshold(struct file * file,
-                                            const char __user * buf,
+ static ssize_t sel_write_avc_cache_threshold(struct file *file,
+                                            const char __user *buf,
                                             size_t count, loff_t *ppos)
  
  {
                goto out;
        }
  
-       page = (char*)get_zeroed_page(GFP_KERNEL);
+       page = (char *)get_zeroed_page(GFP_KERNEL);
        if (!page) {
                ret = -ENOMEM;
                goto out;
@@@ -1301,7 -1304,7 +1303,7 @@@ out
        return ret;
  }
  
- static ssize_t sel_read_initcon(struct file * file, char __user *buf,
+ static ssize_t sel_read_initcon(struct file *file, char __user *buf,
                                size_t count, loff_t *ppos)
  {
        struct inode *inode;
@@@ -1375,7 -1378,7 +1377,7 @@@ static inline u32 sel_ino_to_perm(unsig
        return (ino & SEL_INO_MASK) % (SEL_VEC_MAX + 1);
  }
  
- static ssize_t sel_read_class(struct file * file, char __user *buf,
+ static ssize_t sel_read_class(struct file *file, char __user *buf,
                                size_t count, loff_t *ppos)
  {
        ssize_t rc, len;
@@@ -1399,7 -1402,7 +1401,7 @@@ static const struct file_operations sel
        .read           = sel_read_class,
  };
  
- static ssize_t sel_read_perm(struct file * file, char __user *buf,
+ static ssize_t sel_read_perm(struct file *file, char __user *buf,
                                size_t count, loff_t *ppos)
  {
        ssize_t rc, len;
                goto out;
        }
  
-       len = snprintf(page, PAGE_SIZE,"%d", sel_ino_to_perm(ino));
+       len = snprintf(page, PAGE_SIZE, "%d", sel_ino_to_perm(ino));
        rc = simple_read_from_buffer(buf, count, ppos, page, len);
        free_page((unsigned long)page);
  out:
@@@ -1640,7 -1643,7 +1642,7 @@@ out
        return ret;
  }
  
- static int sel_fill_super(struct super_block * sb, void * data, int silent)
+ static int sel_fill_super(struct super_block *sb, void *data, int silent)
  {
        int ret;
        struct dentry *dentry;
                goto err;
        }
        inode->i_ino = ++sel_last_ino;
-       isec = (struct inode_security_struct*)inode->i_security;
+       isec = (struct inode_security_struct *)inode->i_security;
        isec->sid = SECINITSID_DEVNULL;
        isec->sclass = SECCLASS_CHR_FILE;
        isec->initialized = 1;
  out:
        return ret;
  err:
-       printk(KERN_ERR "%s:  failed while creating inodes\n", __func__);
+       printk(KERN_ERR "SELinux: %s:  failed while creating inodes\n",
+               __func__);
        goto out;
  }
  
index da0566c4f329ad8d8b61cf9f7e62a612cccbe18b,3a464c75d0479567a35bec0d6ac644226f95d74f..fb4efe4f4bc8a5377192052d65242b683a87b438
@@@ -1,9 -1,9 +1,9 @@@
  /* Authors: Karl MacMillan <kmacmillan@tresys.com>
-  *          Frank Mayer <mayerf@tresys.com>
+  *        Frank Mayer <mayerf@tresys.com>
   *
   * Copyright (C) 2003 - 2004 Tresys Technology, LLC
   *    This program is free software; you can redistribute it and/or modify
-  *    it under the terms of the GNU General Public License as published by
+  *    it under the terms of the GNU General Public License as published by
   *    the Free Software Foundation, version 2.
   */
  
@@@ -11,6 -11,7 +11,6 @@@
  #include <linux/errno.h>
  #include <linux/string.h>
  #include <linux/spinlock.h>
 -#include <asm/semaphore.h>
  #include <linux/slab.h>
  
  #include "security.h"
@@@ -89,7 -90,7 +89,7 @@@ static int cond_evaluate_expr(struct po
  int evaluate_cond_node(struct policydb *p, struct cond_node *node)
  {
        int new_state;
-       struct cond_av_listcur;
+       struct cond_av_list *cur;
  
        new_state = cond_evaluate_expr(p, node->expr);
        if (new_state != node->cur_state) {
                        printk(KERN_ERR "SELinux: expression result was undefined - disabling all rules.\n");
                /* turn the rules on or off */
                for (cur = node->true_list; cur != NULL; cur = cur->next) {
-                       if (new_state <= 0) {
+                       if (new_state <= 0)
                                cur->node->key.specified &= ~AVTAB_ENABLED;
-                       } else {
+                       else
                                cur->node->key.specified |= AVTAB_ENABLED;
-                       }
                }
  
                for (cur = node->false_list; cur != NULL; cur = cur->next) {
                        /* -1 or 1 */
-                       if (new_state) {
+                       if (new_state)
                                cur->node->key.specified &= ~AVTAB_ENABLED;
-                       } else {
+                       else
                                cur->node->key.specified |= AVTAB_ENABLED;
-                       }
                }
        }
        return 0;
@@@ -173,8 -172,8 +171,8 @@@ void cond_policydb_destroy(struct polic
  int cond_init_bool_indexes(struct policydb *p)
  {
        kfree(p->bool_val_to_struct);
-       p->bool_val_to_struct = (struct cond_bool_datum**)
-               kmalloc(p->p_bools.nprim * sizeof(struct cond_bool_datum*), GFP_KERNEL);
+       p->bool_val_to_struct = (struct cond_bool_datum **)
+               kmalloc(p->p_bools.nprim * sizeof(struct cond_bool_datum *), GFP_KERNEL);
        if (!p->bool_val_to_struct)
                return -1;
        return 0;
@@@ -199,7 -198,7 +197,7 @@@ int cond_index_bool(void *key, void *da
                return -EINVAL;
  
        p->p_bool_val_to_name[booldatum->value - 1] = key;
-       p->bool_val_to_struct[booldatum->value -1] = booldatum;
+       p->bool_val_to_struct[booldatum->value - 1] = booldatum;
  
        return 0;
  }
@@@ -251,8 -250,7 +249,7 @@@ err
        return -1;
  }
  
- struct cond_insertf_data
- {
+ struct cond_insertf_data {
        struct policydb *p;
        struct cond_av_list *other;
        struct cond_av_list *head;
@@@ -275,7 -273,7 +272,7 @@@ static int cond_insertf(struct avtab *a
         */
        if (k->specified & AVTAB_TYPE) {
                if (avtab_search(&p->te_avtab, k)) {
-                       printk("SELinux: type rule already exists outside of a conditional.");
+                       printk(KERN_ERR "SELinux: type rule already exists outside of a conditional.\n");
                        goto err;
                }
                /*
                        node_ptr = avtab_search_node(&p->te_cond_avtab, k);
                        if (node_ptr) {
                                if (avtab_search_node_next(node_ptr, k->specified)) {
-                                       printk("SELinux: too many conflicting type rules.");
+                                       printk(KERN_ERR "SELinux: too many conflicting type rules.\n");
                                        goto err;
                                }
                                found = 0;
                                        }
                                }
                                if (!found) {
-                                       printk("SELinux: conflicting type rules.\n");
+                                       printk(KERN_ERR "SELinux: conflicting type rules.\n");
                                        goto err;
                                }
                        }
                } else {
                        if (avtab_search(&p->te_cond_avtab, k)) {
-                               printk("SELinux: conflicting type rules when adding type rule for true.\n");
+                               printk(KERN_ERR "SELinux: conflicting type rules when adding type rule for true.\n");
                                goto err;
                        }
                }
  
        node_ptr = avtab_insert_nonunique(&p->te_cond_avtab, k, d);
        if (!node_ptr) {
-               printk("SELinux: could not insert rule.");
+               printk(KERN_ERR "SELinux: could not insert rule.\n");
                goto err;
        }
  
@@@ -352,9 -350,8 +349,8 @@@ static int cond_read_av_list(struct pol
                return -1;
  
        len = le32_to_cpu(buf[0]);
-       if (len == 0) {
+       if (len == 0)
                return 0;
-       }
  
        data.p = p;
        data.other = other;
  static int expr_isvalid(struct policydb *p, struct cond_expr *expr)
  {
        if (expr->expr_type <= 0 || expr->expr_type > COND_LAST) {
-               printk("SELinux: conditional expressions uses unknown operator.\n");
+               printk(KERN_ERR "SELinux: conditional expressions uses unknown operator.\n");
                return 0;
        }
  
        if (expr->bool > p->p_bools.nprim) {
-               printk("SELinux: conditional expressions uses unknown bool.\n");
+               printk(KERN_ERR "SELinux: conditional expressions uses unknown bool.\n");
                return 0;
        }
        return 1;
@@@ -407,15 -404,14 +403,14 @@@ static int cond_read_node(struct policy
        /* expr */
        len = le32_to_cpu(buf[0]);
  
-       for (i = 0; i < len; i++ ) {
+       for (i = 0; i < len; i++) {
                rc = next_entry(buf, fp, sizeof(u32) * 2);
                if (rc < 0)
                        goto err;
  
                expr = kzalloc(sizeof(struct cond_expr), GFP_KERNEL);
-               if (!expr) {
+               if (!expr)
                        goto err;
-               }
  
                expr->expr_type = le32_to_cpu(buf[0]);
                expr->bool = le32_to_cpu(buf[1]);
                        goto err;
                }
  
-               if (i == 0) {
+               if (i == 0)
                        node->expr = expr;
-               } else {
+               else
                        last->next = expr;
-               }
                last = expr;
        }
  
@@@ -468,11 -463,10 +462,10 @@@ int cond_read_list(struct policydb *p, 
                if (cond_read_node(p, node, fp) != 0)
                        goto err;
  
-               if (i == 0) {
+               if (i == 0)
                        p->cond_list = node;
-               } else {
+               else
                        last->next = node;
-               }
                last = node;
        }
        return 0;
@@@ -489,24 -483,24 +482,24 @@@ void cond_compute_av(struct avtab *ctab
  {
        struct avtab_node *node;
  
-       if(!ctab || !key || !avd)
+       if (!ctab || !key || !avd)
                return;
  
-       for(node = avtab_search_node(ctab, key); node != NULL;
+       for (node = avtab_search_node(ctab, key); node != NULL;
                                node = avtab_search_node_next(node, key->specified)) {
-               if ( (u16) (AVTAB_ALLOWED|AVTAB_ENABLED) ==
-                    (node->key.specified & (AVTAB_ALLOWED|AVTAB_ENABLED)))
+               if ((u16)(AVTAB_ALLOWED|AVTAB_ENABLED) ==
+                   (node->key.specified & (AVTAB_ALLOWED|AVTAB_ENABLED)))
                        avd->allowed |= node->datum.data;
-               if ( (u16) (AVTAB_AUDITDENY|AVTAB_ENABLED) ==
-                    (node->key.specified & (AVTAB_AUDITDENY|AVTAB_ENABLED)))
+               if ((u16)(AVTAB_AUDITDENY|AVTAB_ENABLED) ==
+                   (node->key.specified & (AVTAB_AUDITDENY|AVTAB_ENABLED)))
                        /* Since a '0' in an auditdeny mask represents a
                         * permission we do NOT want to audit (dontaudit), we use
                         * the '&' operand to ensure that all '0's in the mask
                         * are retained (much unlike the allow and auditallow cases).
                         */
                        avd->auditdeny &= node->datum.data;
-               if ( (u16) (AVTAB_AUDITALLOW|AVTAB_ENABLED) ==
-                    (node->key.specified & (AVTAB_AUDITALLOW|AVTAB_ENABLED)))
+               if ((u16)(AVTAB_AUDITALLOW|AVTAB_ENABLED) ==
+                   (node->key.specified & (AVTAB_AUDITALLOW|AVTAB_ENABLED)))
                        avd->auditallow |= node->datum.data;
        }
        return;
diff --combined security/selinux/xfrm.c
index 3b8b994faad48a87fe0b3c5ef739ac2a63dcac2e,7a5bf0978a906e9b8535d8d41b1166ac9dee5e02..8f17f542a1160bc44ccff63f8a0fe07e756e86b5
@@@ -45,6 -45,7 +45,6 @@@
  #include <net/xfrm.h>
  #include <net/checksum.h>
  #include <net/udp.h>
 -#include <asm/semaphore.h>
  #include <asm/atomic.h>
  
  #include "avc.h"
@@@ -180,8 -181,7 +180,7 @@@ int selinux_xfrm_decode_session(struct 
  
                                        if (!ckall)
                                                break;
-                               }
-                               else if (*sid != ctx->ctx_sid)
+                               } else if (*sid != ctx->ctx_sid)
                                        return -EINVAL;
                        }
                }
@@@ -326,8 -326,7 +325,7 @@@ int selinux_xfrm_policy_clone(struct xf
   */
  void selinux_xfrm_policy_free(struct xfrm_sec_ctx *ctx)
  {
-       if (ctx)
-               kfree(ctx);
+       kfree(ctx);
  }
  
  /*
@@@ -372,8 -371,7 +370,7 @@@ int selinux_xfrm_state_alloc(struct xfr
  void selinux_xfrm_state_free(struct xfrm_state *x)
  {
        struct xfrm_sec_ctx *ctx = x->security;
-       if (ctx)
-               kfree(ctx);
+       kfree(ctx);
  }
  
   /*