[PATCH 2/2] incorrect typecast of void* (addr was used and not value pointed at)

Jouni Malinen j
Sat Oct 29 09:18:02 PDT 2011

On Fri, Aug 19, 2011 at 11:48:49AM +0200, Mikael Wikstr?m wrote:
> diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
> @@ -1733,7 +1733,7 @@ void * wpas_p2p_sd_request_upnp(struct
> wpa_supplicant *wpa_s, const u8 *dst,
>  int wpas_p2p_sd_cancel_request(struct wpa_supplicant *wpa_s, void *req)
>  {
>  	if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
> -		return wpa_drv_p2p_sd_cancel_request(wpa_s, (u64) req);
> +		return wpa_drv_p2p_sd_cancel_request(wpa_s, *((u64*)req));

A better way of cleaning this up could be to replace the void *req
argument with u64 req since the only caller for this function is indeed
fetching a 64-bit integer from control interface rather than any real
user space pointer.

Jouni Malinen                                            PGP id EFC895FA

More information about the Hostap mailing list