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: <aWkV-MCweRp1ZF0b@egonzo>
Date: Thu, 15 Jan 2026 17:29:44 +0100
From: Dave Penkler <dpenkler@...il.com>
To: Dominik Karol Pi??tkowski <dominik.karol.piatkowski@...tonmail.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Michael Rubin <matchstick@...erthere.org>,
	Dan Carpenter <dan.carpenter@...aro.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/9] gpib: cec: Unify *allocate_private

On Tue, Jan 13, 2026 at 07:08:56PM +0000, Dominik Karol Pi??tkowski wrote:
> Return values for *allocate_private functions as well as calling code in
> gpib driver are all over the place. Unify them by returning -errno if
> something fails, zero otherwise. Use the returned value as early return
> value in case of error.
> 
> Signed-off-by: Dominik Karol Pi??tkowski <dominik.karol.piatkowski@...tonmail.com>
> ---
>  drivers/gpib/cec/cec_gpib.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpib/cec/cec_gpib.c b/drivers/gpib/cec/cec_gpib.c
> index dbf9b95baabc..6d04becd1058 100644
> --- a/drivers/gpib/cec/cec_gpib.c
> +++ b/drivers/gpib/cec/cec_gpib.c
> @@ -222,7 +222,7 @@ static int cec_allocate_private(struct gpib_board *board)
>  
>  	board->private_data = kmalloc(sizeof(struct cec_priv), GFP_KERNEL);

Maybe you could change all the remaining kmalloc/memset pairs to kzalloc at the same time ?

>  	if (!board->private_data)
> -		return -1;
> +		return -ENOMEM;
>  	priv = board->private_data;
>  	memset(priv, 0, sizeof(struct cec_priv));
>  	init_nec7210_private(&priv->nec7210_priv);
> @@ -239,11 +239,13 @@ static int cec_generic_attach(struct gpib_board *board)
>  {
>  	struct cec_priv *cec_priv;
>  	struct nec7210_priv *nec_priv;
> +	int retval;
>  
>  	board->status = 0;
>  
> -	if (cec_allocate_private(board))
> -		return -ENOMEM;
> +	retval = cec_allocate_private(board);
> +	if (retval < 0)
> +		return retval;
>  	cec_priv = board->private_data;
>  	nec_priv = &cec_priv->nec7210_priv;
>  	nec_priv->read_byte = nec7210_ioport_read_byte;
> -- 
> 2.43.0
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ