On Mon, Mar 4, 2019 at 1:40 AM Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote: > > Switch to bitmap_zalloc() to show clearly what we are allocating. > Besides that it returns pointer of bitmap type instead of opaque void *. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> Acked-by: Kees Cook <keescook@xxxxxxxxxxxx> -Kees > --- > kernel/sysctl.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/kernel/sysctl.c b/kernel/sysctl.c > index 46a0d0a14a66..cea18c7c2594 100644 > --- a/kernel/sysctl.c > +++ b/kernel/sysctl.c > @@ -3167,9 +3167,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; > @@ -3260,7 +3258,7 @@ int proc_do_large_bitmap(struct ctl_table *table, int write, > *ppos += *lenp; > } > > - kfree(tmp_bitmap); > + bitmap_free(tmp_bitmap); > return err; > } > > -- > 2.20.1 > -- Kees Cook