From: Thierry Reding <thierry.reding@gmail.com>
To: Paul Bolle <pebolle@tiscali.nl>
Cc: "Ilia Mirkin" <imirkin@alum.mit.edu>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drm/radeon: silence GCC warning on 32 bit
Date: Fri, 21 Feb 2014 09:20:22 +0100 [thread overview]
Message-ID: <20140221082021.GG22574@ulmo.nvidia.com> (raw)
In-Reply-To: <1392931493.15264.17.camel@x220>
[-- Attachment #1: Type: text/plain, Size: 1755 bytes --]
On Thu, Feb 20, 2014 at 10:24:53PM +0100, Paul Bolle wrote:
> On Thu, 2014-02-20 at 16:07 -0500, Ilia Mirkin wrote:
> > On Thu, Feb 20, 2014 at 4:02 PM, Paul Bolle <pebolle@tiscali.nl> wrote:
> > > @@ -935,7 +935,7 @@ static ssize_t radeon_ttm_gtt_read(struct file *f, char __user *buf,
> > > while (size) {
> > > loff_t p = *pos / PAGE_SIZE;
> > > unsigned off = *pos & ~PAGE_MASK;
> > > - ssize_t cur_size = min(size, PAGE_SIZE - off);
> > > + ssize_t cur_size = min(size, (size_t)(PAGE_SIZE - off));
> >
> > Isn't the usual way of dealing with these to do something like
> >
> > ssize_t cur_size = min_t(ssize_t, size, PAGE_SIZE - off)
>
> I wouldn't know. I did
> $ git grep -n "(size_t)(PAGE_SIZE"
> arch/powerpc/mm/dma-noncoherent.c:357: size_t seg_size = min((size_t)(PAGE_SIZE - offset), size);
> arch/tile/kernel/pci-dma.c:176: size_t bytes = min(size, (size_t)(PAGE_SIZE - offset));
> arch/tile/kernel/pci-dma.c:192: size_t bytes = min(size, (size_t)(PAGE_SIZE - offset));
> drivers/net/wireless/ti/wlcore/main.c:806: len = min(maxlen, (size_t)(PAGE_SIZE - wl->fwlog_size));
> drivers/scsi/libfc/fc_libfc.c:143: (size_t)(PAGE_SIZE - (off & ~PAGE_MASK)));
> drivers/target/tcm_fc/tfc_io.c:160: tlen = min(tlen, (size_t)(PAGE_SIZE -
> drivers/target/tcm_fc/tfc_io.c:311: tlen = min(tlen, (size_t)(PAGE_SIZE -
>
> and concluded my solution was acceptable. Is your alternative considered
> to be better?
Yes, min_t() is specifically meant for this type of situation. On a side
note, I think cur_size should be size_t rather than ssize_t.
Thierry
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2014-02-21 8:20 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-30 2:49 [git pull] drm next tree Dave Airlie
2014-01-30 4:54 ` Linus Torvalds
2014-01-30 12:33 ` Paul Bolle
2014-02-20 21:02 ` [PATCH] drm/radeon: silence GCC warning on 32 bit Paul Bolle
2014-02-20 21:07 ` Ilia Mirkin
2014-02-20 21:24 ` Paul Bolle
2014-02-21 8:20 ` Thierry Reding [this message]
2014-03-04 9:34 ` [PATCH v2] " Paul Bolle
2014-03-04 11:42 ` Christian König
2014-03-04 14:52 ` Alex Deucher
2014-01-30 15:55 ` [git pull] drm next tree Jiri Kosina
2014-02-07 10:08 ` Jiri Kosina
2014-02-07 11:10 ` Jani Nikula
2014-02-07 13:40 ` Jiri Kosina
2014-02-07 14:05 ` Daniel Vetter
2014-02-07 14:15 ` Jiri Kosina
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=20140221082021.GG22574@ulmo.nvidia.com \
--to=thierry.reding@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=imirkin@alum.mit.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=pebolle@tiscali.nl \
/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;
as well as URLs for NNTP newsgroup(s).