Thread (4 messages) flat view 4 messages, 3 authors, 2021-09-25

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

From: Len Baker <hidden>
Date: 2021-09-25 07:29:23
Also in: linux-hardening, linux-rdma, lkml

Hi,

On Mon, Sep 20, 2021 at 09:06:35PM -0700, Kees Cook wrote:
quoted
-	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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help