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  linux-cve-announce  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:   Sun, 9 Aug 2020 08:50:32 +0300
From:   Eli Cohen <eli@...lanox.com>
To:     Alex Dewar <alex.dewar@....co.uk>
Cc:     "Michael S. Tsirkin" <mst@...hat.com>,
        Jason Wang <jasowang@...hat.com>,
        Parav Pandit <parav@...lanox.com>,
        virtualization@...ts.linux-foundation.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] vdpa/mlx5: Fix uninitialised variable in core/mr.c

On Thu, Aug 06, 2020 at 07:56:15PM +0100, Alex Dewar wrote:

Acked-by: Eli Cohen <eli@...lanox.com>
> If the kernel is unable to allocate memory for the variable dmr then
> err will be returned without being set. Set err to -ENOMEM in this
> case.
> 
> Fixes: 94abbccdf291 ("vdpa/mlx5: Add shared memory registration code")
> Addresses-Coverity: ("Uninitialized variables")
> Signed-off-by: Alex Dewar <alex.dewar@....co.uk>
> ---
>  drivers/vdpa/mlx5/core/mr.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/vdpa/mlx5/core/mr.c b/drivers/vdpa/mlx5/core/mr.c
> index f5dec0274133..ef1c550f8266 100644
> --- a/drivers/vdpa/mlx5/core/mr.c
> +++ b/drivers/vdpa/mlx5/core/mr.c
> @@ -319,8 +319,10 @@ static int add_direct_chain(struct mlx5_vdpa_dev *mvdev, u64 start, u64 size, u8
>  	while (size) {
>  		sz = (u32)min_t(u64, MAX_KLM_SIZE, size);
>  		dmr = kzalloc(sizeof(*dmr), GFP_KERNEL);
> -		if (!dmr)
> +		if (!dmr) {
> +			err = -ENOMEM;
>  			goto err_alloc;
> +		}
> 
>  		dmr->start = st;
>  		dmr->end = st + sz;
> --
> 2.28.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ