From: nab@linux-iscsi.org (Nicholas A. Bellinger)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] target: fix cast from pointer to phys_addr_t
Date: Tue, 02 Feb 2016 14:08:49 -0800 [thread overview]
Message-ID: <1454450929.25549.1.camel@haakon3.risingtidesystems.com> (raw)
In-Reply-To: <3114027.BKdWsaRxO0@wuerfel>
(Adding Andy CC')
On Mon, 2016-02-01 at 17:29 +0100, Arnd Bergmann wrote:
> The uio_mem structure has a member that is a phys_addr_t, but can
> be a number of other types too. The target core driver attempts
> to assign a pointer from vmalloc() to it, by casting it to
> phys_addr_t, but that causes a warning when phys_addr_t is longer
> than a pointer:
>
> drivers/target/target_core_user.c: In function 'tcmu_configure_device':
> drivers/target/target_core_user.c:906:22: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
>
> This adds another cast to uintptr_t to shut up the warning.
> A nicer fix might be to have additional fields in uio_mem
> for the different purposes, so we can assign a pointer directly.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> This has been around for a long while, but did not trigger in
> my randconfig testing until now, don't know why.
>
> diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
> index dd600e5ead71..94f5154ac788 100644
> --- a/drivers/target/target_core_user.c
> +++ b/drivers/target/target_core_user.c
> @@ -903,7 +903,7 @@ static int tcmu_configure_device(struct se_device *dev)
> info->version = __stringify(TCMU_MAILBOX_VERSION);
>
> info->mem[0].name = "tcm-user command & data buffer";
> - info->mem[0].addr = (phys_addr_t) udev->mb_addr;
> + info->mem[0].addr = (phys_addr_t)(uintptr_t)udev->mb_addr;
> info->mem[0].size = TCMU_RING_SIZE;
> info->mem[0].memtype = UIO_MEM_VIRTUAL;
>
>
Applied to target-pending/master.
Thanks Arnd.
prev parent reply other threads:[~2016-02-02 22:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-01 16:29 [PATCH] target: fix cast from pointer to phys_addr_t Arnd Bergmann
2016-02-02 22:08 ` Nicholas A. Bellinger [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1454450929.25549.1.camel@haakon3.risingtidesystems.com \
--to=nab@linux-iscsi.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox