Re: [PATCH] net/mlx5: DR, Prefer kcalloc over open coded arithmetic
From: Len Baker
Date: Sat Sep 25 2021 - 03:29:26 EST
Hi,
On Mon, Sep 20, 2021 at 09:06:35PM -0700, Kees Cook wrote:
> >
> > - ref_actions = kzalloc(sizeof(*ref_actions) * num_of_dests * 2, GFP_KERNEL);
> > + if (unlikely(check_mul_overflow(num_of_dests, 2u, &ref_act_cnt)))
> > + goto free_hw_dests;
> > +
> > + ref_actions = kcalloc(ref_act_cnt, sizeof(*ref_actions), GFP_KERNEL);
>
> In the future, consider array3_size(), but this is fine too. :)
Ok, thanks for the advise.
Regards,
Len