[PATCH] RADIUS client: Fix void-pointer-to-enum-cast warning

Johannes Berg johannes at sipsolutions.net
Wed Apr 21 20:13:39 BST 2021


On Fri, 2021-04-16 at 04:11 +0000, Joshua Emele wrote:
> Found using x86_64-cros-linux-gnu-clang:
> 
> radius_client.c:818:24: warning: cast to smaller integer ...
>         RadiusType msg_type = (RadiusType) sock_ctx;
> 
> Signed-off-by: Joshua Emele <jemele at chromium.org>
> ---
>  src/radius/radius_client.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/radius/radius_client.c b/src/radius/radius_client.c
> index 4f0ff0754..d0cfc9533 100644
> --- a/src/radius/radius_client.c
> +++ b/src/radius/radius_client.c
> @@ -815,7 +815,7 @@ static void radius_client_receive(int sock, void *eloop_ctx, void *sock_ctx)
>  {
>  	struct radius_client_data *radius = eloop_ctx;
>  	struct hostapd_radius_servers *conf = radius->conf;
> -	RadiusType msg_type = (RadiusType) sock_ctx;
> +	RadiusType msg_type = (RadiusType)(uintptr_t) sock_ctx;

If RadiusType is an integer type, then you don't really need the
(RadiusType) cast anymore, do you?

johannes




More information about the Hostap mailing list