[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Sat, 8 Aug 2009 07:20:31 -0400
From: Jeff Layton <jlayton@...hat.com>
To: Johannes Weiner <hannes@...xchg.org>
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
akpm@...ux-foundation.org, hch@...radead.org, rlove@...gle.com,
msb@...gle.com, viro@...iv.linux.org.uk
Subject: Re: [PATCH 2/4] vfs: explicitly cast s_maxbytes in
fiemap_check_ranges
On Sat, 8 Aug 2009 00:12:52 +0200
Johannes Weiner <hannes@...xchg.org> wrote:
> On Fri, Aug 07, 2009 at 02:57:39PM -0400, Jeff Layton wrote:
> > If fiemap_check_ranges is passed a large enough value, then it's
> > possible that the value would be cast to a signed value for comparison
> > against s_maxbytes when we change it to loff_t. Make sure that doesn't
> > happen by explicitly casting s_maxbytes to an unsigned value for the
> > purposes of comparison.
>
> I think this is unneeded, C garuantees that in this case the signed
> value will get promoted to an unsigned value, not the other way round.
>
After looking at this again, I think you're correct. do_sendfile was
actually casting s_maxbytes to a signed value which is why it was
broken there.
I can drop this patch if the consensus is to do so. I still think
however that it doesn't hurt to do explict casts when comparing signed
and unsigned values to remove any potential for ambiguity.
--
Jeff Layton <jlayton@...hat.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists