aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/ss/ebitmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/selinux/ss/ebitmap.c')
-rw-r--r--security/selinux/ss/ebitmap.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/security/selinux/ss/ebitmap.c b/security/selinux/ss/ebitmap.c
index d515154128cc..47024a6e1844 100644
--- a/security/selinux/ss/ebitmap.c
+++ b/security/selinux/ss/ebitmap.c
@@ -39,12 +39,11 @@ int ebitmap_cpy(struct ebitmap *dst, struct ebitmap *src)
39 n = src->node; 39 n = src->node;
40 prev = NULL; 40 prev = NULL;
41 while (n) { 41 while (n) {
42 new = kmalloc(sizeof(*new), GFP_ATOMIC); 42 new = kzalloc(sizeof(*new), GFP_ATOMIC);
43 if (!new) { 43 if (!new) {
44 ebitmap_destroy(dst); 44 ebitmap_destroy(dst);
45 return -ENOMEM; 45 return -ENOMEM;
46 } 46 }
47 memset(new, 0, sizeof(*new));
48 new->startbit = n->startbit; 47 new->startbit = n->startbit;
49 new->map = n->map; 48 new->map = n->map;
50 new->next = NULL; 49 new->next = NULL;
@@ -150,10 +149,9 @@ int ebitmap_set_bit(struct ebitmap *e, unsigned long bit, int value)
150 if (!value) 149 if (!value)
151 return 0; 150 return 0;
152 151
153 new = kmalloc(sizeof(*new), GFP_ATOMIC); 152 new = kzalloc(sizeof(*new), GFP_ATOMIC);
154 if (!new) 153 if (!new)
155 return -ENOMEM; 154 return -ENOMEM;
156 memset(new, 0, sizeof(*new));
157 155
158 new->startbit = bit & ~(MAPSIZE - 1); 156 new->startbit = bit & ~(MAPSIZE - 1);
159 new->map = (MAPBIT << (bit - new->startbit)); 157 new->map = (MAPBIT << (bit - new->startbit));
@@ -232,13 +230,12 @@ int ebitmap_read(struct ebitmap *e, void *fp)
232 printk(KERN_ERR "security: ebitmap: truncated map\n"); 230 printk(KERN_ERR "security: ebitmap: truncated map\n");
233 goto bad; 231 goto bad;
234 } 232 }
235 n = kmalloc(sizeof(*n), GFP_KERNEL); 233 n = kzalloc(sizeof(*n), GFP_KERNEL);
236 if (!n) { 234 if (!n) {
237 printk(KERN_ERR "security: ebitmap: out of memory\n"); 235 printk(KERN_ERR "security: ebitmap: out of memory\n");
238 rc = -ENOMEM; 236 rc = -ENOMEM;
239 goto bad; 237 goto bad;
240 } 238 }
241 memset(n, 0, sizeof(*n));
242 239
243 n->startbit = le32_to_cpu(buf[0]); 240 n->startbit = le32_to_cpu(buf[0]);
244 241