lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sat, 25 Sep 2021 09:28:56 +0200
From:   Len Baker <len.baker@....com>
To:     Kees Cook <keescook@...omium.org>
Cc:     Len Baker <len.baker@....com>, Saeed Mahameed <saeedm@...dia.com>,
        Leon Romanovsky <leon@...nel.org>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Yevgeny Kliteynik <kliteyn@...dia.com>,
        Alex Vesker <valex@...dia.com>,
        Erez Shitrit <erezsh@...dia.com>,
        Jianbo Liu <jianbol@...dia.com>, netdev@...r.kernel.org,
        linux-rdma@...r.kernel.org, linux-hardening@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net/mlx5: DR, Prefer kcalloc over open coded arithmetic

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

Powered by blists - more mailing lists