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]
Message-ID: <b98816a2-1e81-f309-c870-477dc08b7c60@xs4all.nl>
Date:   Fri, 8 Sep 2017 15:42:27 +0200
From:   Hans Verkuil <hverkuil@...all.nl>
To:     SF Markus Elfring <elfring@...rs.sourceforge.net>,
        linux-media@...r.kernel.org,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Olli Salonen <olli.salonen@....fi>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: Re: [PATCH 3/4] [media] sp2: Adjust a jump target in sp2_probe()

Hi Markus,

On 09/01/17 21:44, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Fri, 1 Sep 2017 21:08:38 +0200
> 
> * Adjust a jump target so that a null pointer will not be passed to a call
>   of the function "kfree".
> 
> * Move this function call into an if branch.
> 
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
> ---
>  drivers/media/dvb-frontends/sp2.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/media/dvb-frontends/sp2.c b/drivers/media/dvb-frontends/sp2.c
> index dd556012ceb6..b2a7a54174ae 100644
> --- a/drivers/media/dvb-frontends/sp2.c
> +++ b/drivers/media/dvb-frontends/sp2.c
> @@ -384,7 +384,7 @@ static int sp2_probe(struct i2c_client *client,
>  	s = kzalloc(sizeof(*s), GFP_KERNEL);
>  	if (!s) {
>  		ret = -ENOMEM;
> -		goto err;
> +		goto report_failure;
>  	}
>  
>  	s->client = client;
> @@ -395,15 +395,16 @@ static int sp2_probe(struct i2c_client *client,
>  	i2c_set_clientdata(client, s);
>  
>  	ret = sp2_init(s);
> -	if (ret)
> -		goto err;
> +	if (ret) {
> +		kfree(s);
> +		goto report_failure;
> +	}
>  
>  	dev_info(&s->client->dev, "CIMaX SP2 successfully attached\n");
>  	return 0;
> -err:
> -	dev_dbg(&client->dev, "init failed=%d\n", ret);
> -	kfree(s);
>  
> +report_failure:
> +	dev_dbg(&client->dev, "init failed=%d\n", ret);
>  	return ret;
>  }
>  
> 

It's perfectly fine to call kfree() with a NULL pointer, and I don't think
that this patch makes the code more readable, so I'm dropping this patch.

Regards,

	Hans

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ