Re: [PATCH 6/6] net/9p: Fix compile warning

From: Geert Uytterhoeven
Date: Sat Mar 19 2011 - 16:17:57 EST


These warnings?

net/9p/trans_common.c:45: warning: cast from pointer to integer of
different size
net/9p/trans_common.c:46: warning: cast from pointer to integer of
different size
net/9p/trans_common.c:72: warning: comparison of distinct pointer
types lacks a cast

On Tue, Mar 1, 2011 at 09:51, Aneesh Kumar K.V
<aneesh.kumar@xxxxxxxxxxxxxxxxxx> wrote:
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxxxxxxxxxxx>
> ---
> Ânet/9p/trans_common.c | Â Â8 ++++----
> Â1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/net/9p/trans_common.c b/net/9p/trans_common.c
> index d62b9aa..ca55e3b 100644
> --- a/net/9p/trans_common.c
> +++ b/net/9p/trans_common.c
> @@ -42,8 +42,8 @@ int
> Âp9_nr_pages(struct p9_req_t *req)
> Â{
> Â Â Â Âint start_page, end_page;

In addition, the values may not fit in an int on 64-bit. Better use
'unsigned long'.

> - Â Â Â start_page = Â(unsigned long long)req->tc->pubuf >> PAGE_SHIFT;
> - Â Â Â end_page = ((unsigned long long)req->tc->pubuf + req->tc->pbuf_size +
> + Â Â Â start_page = Â(unsigned long)req->tc->pubuf >> PAGE_SHIFT;
> + Â Â Â end_page = ((unsigned long)req->tc->pubuf + req->tc->pbuf_size +
> Â Â Â Â Â Â Â Â Â Â Â ÂPAGE_SIZE - 1) >> PAGE_SHIFT;
> Â Â Â Âreturn end_page - start_page;
> Â}
> @@ -69,8 +69,8 @@ p9_payload_gup(struct p9_req_t *req, size_t *pdata_off, int *pdata_len,
> Â Â Â Â*pdata_off = (size_t)req->tc->pubuf & (PAGE_SIZE-1);
>
> Â Â Â Âif (*pdata_off)
> - Â Â Â Â Â Â Â first_page_bytes = min((PAGE_SIZE - *pdata_off),
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â req->tc->pbuf_size);
> + Â Â Â Â Â Â Â first_page_bytes = min(((size_t)PAGE_SIZE - *pdata_off),
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âreq->tc->pbuf_size);
>
> Â Â Â Ârpinfo = req->tc->private;
> Â Â Â Âpdata_mapped_pages = get_user_pages_fast((unsigned long)req->tc->pubuf,
> --
> 1.7.1

Gr{oetje,eeting}s,

            Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
             Â Â -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/