Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Nov 2015 09:17:06 -0800
From:      Conrad Meyer <cem@FreeBSD.org>
To:        Hans Petter Selasky <hselasky@freebsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r290711 - head/sys/ofed/drivers/infiniband/core
Message-ID:  <CAG6CVpWKsa3SwX27JpxBeQDikeDWJXyUGWG8sS=9DvzbML9xcA@mail.gmail.com>
In-Reply-To: <201511121012.tACACKTI075143@repo.freebsd.org>
References:  <201511121012.tACACKTI075143@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
These should cast through (u)intptr_t rather than unsigned long.

Best,
Conrad

On Thu, Nov 12, 2015 at 2:12 AM, Hans Petter Selasky
<hselasky@freebsd.org> wrote:
> Author: hselasky
> Date: Thu Nov 12 10:12:20 2015
> New Revision: 290711
> URL: https://svnweb.freebsd.org/changeset/base/290711
>
> Log:
>   Fix integer to pointer of different size conversion warnings when
>   using GCC for 32-bit platforms. The integer size in this case is
>   hardcoded 64-bit while the pointer size is 32-bit.
>
>   Sponsored by: Mellanox Technologies
>   MFC after:    2 weeks
>
> Modified:
>   head/sys/ofed/drivers/infiniband/core/uverbs_cmd.c
>   head/sys/ofed/drivers/infiniband/core/uverbs_main.c
>
> Modified: head/sys/ofed/drivers/infiniband/core/uverbs_cmd.c
> ==============================================================================
> --- head/sys/ofed/drivers/infiniband/core/uverbs_cmd.c  Thu Nov 12 09:56:25 2015        (r290710)
> +++ head/sys/ofed/drivers/infiniband/core/uverbs_cmd.c  Thu Nov 12 10:12:20 2015        (r290711)
> @@ -1379,7 +1379,8 @@ ssize_t ib_uverbs_create_cq(struct ib_uv
>                 return -EFAULT;
>
>         return create_cq(file, buf, in_len, out_len, &cmd,
> -                        IB_USER_VERBS_CMD_BASIC, (void __user *)cmd.response);
> +                        IB_USER_VERBS_CMD_BASIC,
> +                        (void __user *) (unsigned long) cmd.response);
>  }
>
>  ssize_t ib_uverbs_resize_cq(struct ib_uverbs_file *file,
> @@ -1609,7 +1610,7 @@ ssize_t ib_uverbs_create_qp(struct ib_uv
>         if (copy_from_user(&cmd_obj, buf, cmd_size))
>                 return -EFAULT;
>
> -       response = (void __user *)cmd->response;
> +       response = (void __user *) (unsigned long) cmd->response;
>
>         if (!disable_raw_qp_enforcement &&
>             cmd->qp_type == IB_QPT_RAW_PACKET && !priv_check(curthread, PRIV_NET_RAW))
>
> Modified: head/sys/ofed/drivers/infiniband/core/uverbs_main.c
> ==============================================================================
> --- head/sys/ofed/drivers/infiniband/core/uverbs_main.c Thu Nov 12 09:56:25 2015        (r290710)
> +++ head/sys/ofed/drivers/infiniband/core/uverbs_main.c Thu Nov 12 10:12:20 2015        (r290711)
> @@ -81,8 +81,8 @@ static struct ib_udata_ops uverbs_copy_e
>  #define INIT_UDATA_EX(udata, ibuf, obuf, ilen, olen)           \
>         do {                                                    \
>                 (udata)->ops    = &uverbs_copy_ex;              \
> -               (udata)->inbuf  = (void __user *)(ibuf);        \
> -               (udata)->outbuf = (void __user *)(obuf);        \
> +               (udata)->inbuf  = (void __user *)(unsigned long)(ibuf); \
> +               (udata)->outbuf = (void __user *)(unsigned long)(obuf); \
>                 (udata)->inlen  = (ilen);                       \
>                 (udata)->outlen = (olen);                       \
>         } while (0)
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG6CVpWKsa3SwX27JpxBeQDikeDWJXyUGWG8sS=9DvzbML9xcA>