aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Shevchenko <[email protected]>2019-05-14 15:44:52 -0700
committerLinus Torvalds <[email protected]>2019-05-14 19:52:51 -0700
commit475dae385497dde3f25271ce77b526a1e54a472a (patch)
tree34bc7e41b259273c74034e507907467be75ff67f
parent23015b22e47c5409620b1726a677d69e5cd032ba (diff)
kernel/sysctl.c: switch to bitmap_zalloc()
Switch to bitmap_zalloc() to show clearly what we are allocating. Besides that it returns pointer of bitmap type instead of opaque void *. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Kees Cook <[email protected]> Reviewed-by: Andrew Morton <[email protected]> Cc: Luis Chamberlain <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r--kernel/sysctl.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index ba158f61aab4..d82f9161adb8 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -3178,9 +3178,7 @@ int proc_do_large_bitmap(struct ctl_table *table, int write,
if (IS_ERR(kbuf))
return PTR_ERR(kbuf);
- tmp_bitmap = kcalloc(BITS_TO_LONGS(bitmap_len),
- sizeof(unsigned long),
- GFP_KERNEL);
+ tmp_bitmap = bitmap_zalloc(bitmap_len, GFP_KERNEL);
if (!tmp_bitmap) {
kfree(kbuf);
return -ENOMEM;
@@ -3271,7 +3269,7 @@ int proc_do_large_bitmap(struct ctl_table *table, int write,
*ppos += *lenp;
}
- kfree(tmp_bitmap);
+ bitmap_free(tmp_bitmap);
return err;
}