/* Read a MLS level structure from a policydb binary representation file.  */
static int mls_read_level(struct mls_level *lp, void *fp)
/* Read a MLS level structure from a policydb binary representation file.  */
static int mls_read_level(struct mls_level *lp, void *fp)
{
	__le32 buf[1];
	int rc;
	memset(lp, 0, sizeof(*lp));
	rc = next_entry(buf, fp, sizeof buf);
	if (rc < 0) {
		printk(KERN_ERR "SELinux: mls: truncated level\n");
		goto bad;
	}
	lp->sens = le32_to_cpu(buf[0]);
	if (ebitmap_read(&lp->cat, fp)) {
		printk(KERN_ERR "SELinux: mls:  error reading level "
		       "categories\n");
		goto bad;
	}
	return 0;
bad:
	return -EINVAL;
}