n1 = e1->node;
n2 = e2->node;
- prev = 0;
+ prev = NULL;
while (n1 || n2) {
new = kmalloc(sizeof(*new), GFP_ATOMIC);
if (!new) {
n2 = n2->next;
}
- new->next = 0;
+ new->next = NULL;
if (prev)
prev->next = new;
else
ebitmap_init(dst);
n = src->node;
- prev = 0;
+ prev = NULL;
while (n) {
new = kmalloc(sizeof(*new), GFP_ATOMIC);
if (!new) {
memset(new, 0, sizeof(*new));
new->startbit = n->startbit;
new->map = n->map;
- new->next = 0;
+ new->next = NULL;
if (prev)
prev->next = new;
else
{
struct ebitmap_node *n, *prev, *new;
- prev = 0;
+ prev = NULL;
n = e->node;
while (n && n->startbit <= bit) {
if ((n->startbit + MAPSIZE) > bit) {
}
e->highbit = 0;
- e->node = 0;
+ e->node = NULL;
return;
}
int ebitmap_read(struct ebitmap *e, void *fp)
{
- int rc = -EINVAL;
+ int rc;
struct ebitmap_node *n, *l;
- u32 *buf, mapsize, count, i;
+ u32 buf[3], mapsize, count, i;
u64 map;
ebitmap_init(e);
- buf = next_entry(fp, sizeof(u32)*3);
- if (!buf)
+ rc = next_entry(buf, fp, sizeof buf);
+ if (rc < 0)
goto out;
mapsize = le32_to_cpu(buf[0]);
printk(KERN_ERR "security: ebitmap: map size %u does not "
"match my size %Zd (high bit was %d)\n", mapsize,
MAPSIZE, e->highbit);
- goto out;
+ goto bad;
}
if (!e->highbit) {
e->node = NULL;
}
l = NULL;
for (i = 0; i < count; i++) {
- buf = next_entry(fp, sizeof(u32));
- if (!buf) {
+ rc = next_entry(buf, fp, sizeof(u32));
+ if (rc < 0) {
printk(KERN_ERR "security: ebitmap: truncated map\n");
goto bad;
}
n->startbit, (e->highbit - MAPSIZE));
goto bad_free;
}
- buf = next_entry(fp, sizeof(u64));
- if (!buf) {
+ rc = next_entry(&map, fp, sizeof(u64));
+ if (rc < 0) {
printk(KERN_ERR "security: ebitmap: truncated map\n");
goto bad_free;
}
- memcpy(&map, buf, sizeof(u64));
n->map = le64_to_cpu(map);
if (!n->map) {
bad_free:
kfree(n);
bad:
+ if (!rc)
+ rc = -EINVAL;
ebitmap_destroy(e);
goto out;
}