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] [thread-next>] [day] [month] [year] [list]
Message-ID: <8f8130b2-fec1-48bc-944e-e676a1715c31@bootlin.com>
Date: Sat, 5 Jul 2025 16:17:35 +0200
From: Thomas Richard <thomas.richard@...tlin.com>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>,
 Dave Penkler <dpenkler@...il.com>,
 Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
 linux-staging@...ts.linux.dev
Subject: Re: [PATCH v2] staging: gpib: Fix error handling paths in
 cb_gpib_probe()

Hi Christophe,

On 7/5/25 11:52 AM, Christophe JAILLET wrote:
> If cb_gpib_config() fails, 'info' needs to be freed, as already done in the
> remove function.
> 
> While at it, remove a pointless comment related to gpib_attach().
> 
> Fixes: e9dc69956d4d ("staging: gpib: Add Computer Boards GPIB driver")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> ---
> Changes in v2:
>   - Fix the Fixes tag   [Thomas Richard]
>   - Synch with latest -next
>   - no compile tested. I think, thanks to commit 79d2e1919a27
>     ("staging: gpib: fix Makefiles")
> 
> v1: https://lore.kernel.org/all/459c267de8c9bf48fcb555364930ae7e3cdc798b.1729940596.git.christophe.jaillet@wanadoo.fr/
> 
> Compile tested only.
> ---
>  drivers/staging/gpib/cb7210/cb7210.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/gpib/cb7210/cb7210.c b/drivers/staging/gpib/cb7210/cb7210.c
> index 298ed306189d..3e2397898a9b 100644
> --- a/drivers/staging/gpib/cb7210/cb7210.c
> +++ b/drivers/staging/gpib/cb7210/cb7210.c
> @@ -1184,8 +1184,7 @@ struct local_info {
>  static int cb_gpib_probe(struct pcmcia_device *link)
>  {
>  	struct local_info *info;
> -
> -//	int ret, i;
> +	int ret;
>  
>  	/* Allocate space for private device-specific data */
>  	info = kzalloc(sizeof(*info), GFP_KERNEL);

You should use devm_kzalloc(). The memory will be automatically freed by
the core. So no need to call kfree() in case of error during the probe.
And you can remove the kfree() in cb_gpib_remove().

Regards,

Thomas

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ