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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 14 Feb 2024 07:25:10 +0100
From: Jiri Slaby <jirislaby@...nel.org>
To: Arnd Bergmann <arnd@...nel.org>,
 Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Arnd Bergmann <arnd@...db.de>, Nathan Chancellor <nathan@...nel.org>,
 Nick Desaulniers <ndesaulniers@...gle.com>, Bill Wendling
 <morbo@...gle.com>, Justin Stitt <justinstitt@...gle.com>,
 linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org,
 linux-serial@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH] tty: hvc-iucv: fix function pointer casts

On 13. 02. 24, 11:17, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
> 
> clang warns about explicitly casting between incompatible function
> pointers:
> 
> drivers/tty/hvc/hvc_iucv.c:1100:23: error: cast from 'void (*)(const void *)' to 'void (*)(struct device *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
>   1100 |         priv->dev->release = (void (*)(struct device *)) kfree;
>        |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Add a separate function to handle this correctly.
> 
> Signed-off-by: Arnd Bergmann <arnd@...db.de>

Reviewed-by: Jiri Slaby <jirislaby@...nel.org>

> diff --git a/drivers/tty/hvc/hvc_iucv.c b/drivers/tty/hvc/hvc_iucv.c
> index fdecc0d63731..b1149bc62ca1 100644
> --- a/drivers/tty/hvc/hvc_iucv.c
> +++ b/drivers/tty/hvc/hvc_iucv.c
> @@ -1035,6 +1035,10 @@ static const struct attribute_group *hvc_iucv_dev_attr_groups[] = {
>   	NULL,
>   };
>   
> +static void hvc_iucv_free(struct device *data)
> +{
> +	kfree(data);
> +}
>   
>   /**
>    * hvc_iucv_alloc() - Allocates a new struct hvc_iucv_private instance
> @@ -1097,7 +1101,7 @@ static int __init hvc_iucv_alloc(int id, unsigned int is_console)
>   	priv->dev->bus = &iucv_bus;
>   	priv->dev->parent = iucv_root;
>   	priv->dev->groups = hvc_iucv_dev_attr_groups;
> -	priv->dev->release = (void (*)(struct device *)) kfree;
> +	priv->dev->release = hvc_iucv_free;
>   	rc = device_register(priv->dev);
>   	if (rc) {
>   		put_device(priv->dev);

-- 
js
suse labs


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ