Przeglądaj źródła

SELinux: silence build warning when !CONFIG_BUG

If one builds a kernel without CONFIG_BUG there are a number of 'may be
used uninitialized' warnings.  Silence these by returning after the BUG().

Signed-off-by: Eric Paris <eparis@redhat.com>
Reviewed-by: James Morris <jmorris@namei.org>
Eric Paris 14 lat temu
rodzic
commit
a35c6c8368
2 zmienionych plików z 3 dodań i 0 usunięć
  1. 2 0
      security/selinux/hooks.c
  2. 1 0
      security/selinux/netnode.c

+ 2 - 0
security/selinux/hooks.c

@@ -989,6 +989,7 @@ static void selinux_write_opts(struct seq_file *m,
 			continue;
 			continue;
 		default:
 		default:
 			BUG();
 			BUG();
+			return;
 		};
 		};
 		/* we need a comma before each option */
 		/* we need a comma before each option */
 		seq_putc(m, ',');
 		seq_putc(m, ',');
@@ -1442,6 +1443,7 @@ static int task_has_capability(struct task_struct *tsk,
 		printk(KERN_ERR
 		printk(KERN_ERR
 		       "SELinux:  out of range capability %d\n", cap);
 		       "SELinux:  out of range capability %d\n", cap);
 		BUG();
 		BUG();
+		return -EINVAL;
 	}
 	}
 
 
 	rc = avc_has_perm_noaudit(sid, sid, sclass, av, 0, &avd);
 	rc = avc_has_perm_noaudit(sid, sid, sclass, av, 0, &avd);

+ 1 - 0
security/selinux/netnode.c

@@ -141,6 +141,7 @@ static struct sel_netnode *sel_netnode_find(const void *addr, u16 family)
 		break;
 		break;
 	default:
 	default:
 		BUG();
 		BUG();
+		return NULL;
 	}
 	}
 
 
 	list_for_each_entry_rcu(node, &sel_netnode_hash[idx].list, list)
 	list_for_each_entry_rcu(node, &sel_netnode_hash[idx].list, list)