All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
To: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [patch 2.6.22-rc2-git] spidev compiler warning gone
Date: Tue, 29 May 2007 15:39:04 -0700	[thread overview]
Message-ID: <200705291539.04253.david-b@pacbell.net> (raw)
In-Reply-To: <20070529150214.75204439.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>

On Tuesday 29 May 2007, Andrew Morton wrote:
> On Fri, 25 May 2007 10:35:07 -0700
> David Brownell <david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org> wrote:
> 
> > Get rid of annoying GCC warning on 32-bit platforms.  The trick is to
> > add an extra cast using "ptrdiff_t" to convert the u64 to the correct
> > size integer, and only then casting it into a "void *" pointer.
> > 
> >	...
> > -			if (__copy_to_user((u8 __user *)u_tmp->rx_buf, buf,
> > +			if (__copy_to_user((u8 __user *)
> > +					(ptrdiff_t) u_tmp->rx_buf, buf,
> > 	...
> 
> This seems overly tricky.  The way we normally squish that warning is
> via a (long) cast.

Well, "ptrdiff_t" seems equivalent to "long" in common cases.

Presumably C99 guarantees pointer-to-long conversions work in
both directions?  It seemed there must necessarily be such a
guarantee for "ptrdiff_t", even if it weren't true for "long".
I didn't have a copy of a C spec to consult.  ;)

- Dave

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

  parent reply	other threads:[~2007-05-29 22:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-25 17:35 [patch 2.6.22-rc2-git] spidev compiler warning gone David Brownell
     [not found] ` <200705251035.10587.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2007-05-29 22:02   ` Andrew Morton
     [not found]     ` <20070529150214.75204439.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2007-05-29 22:39       ` David Brownell [this message]
     [not found]         ` <200705291539.04253.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2007-05-29 22:59           ` Andrew Morton
     [not found]             ` <20070529155911.105c65b7.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2007-05-30  2:05               ` David Brownell
     [not found]                 ` <200705291905.34670.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2007-05-30  2:19                   ` Andrew Morton

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=200705291539.04253.david-b@pacbell.net \
    --to=david-b-ybekhbn/0ldr7s880joybq@public.gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.