Re: [PATCH] net/mlx5: DR, Prefer kcalloc over open coded arithmetic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux