From: Dave Chinner <david@fromorbit.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Ben Myers <bpm@sgi.com>, Alex Elder <elder@kernel.org>,
kernel-janitors@vger.kernel.org, xfs@oss.sgi.com
Subject: Re: [patch] xfs: bug widening binary "not" operation
Date: Fri, 17 May 2013 20:19:08 +1000 [thread overview]
Message-ID: <20130517101908.GS24635@dastard> (raw)
In-Reply-To: <20130517063159.GO1360@mwanda>
On Fri, May 17, 2013 at 09:31:59AM +0300, Dan Carpenter wrote:
> On Fri, May 17, 2013 at 09:03:14AM +1000, Dave Chinner wrote:
> > As it is, the static checker missed the:
> >
> > rounding = max_t(uint, ....);
> >
> > The line before the above usage. I posted a patch to fix this this
> > 2 weeks ago here:
> >
> > http://oss.sgi.com/pipermail/xfs/2013-May/025986.html
> >
>
> Ah. Grand. There is still a problem with the max_t(). The shift
> operation will wrap before we do the cast. It should be:
It probably looks that way, but it can't overflow as
mp->m_sb.sb_blocklog has a maximum value of 16 (i.e. 64k maximum
filesystem block size).
>
> - rounding = max_t(xfs_off_t, 1 << mp->m_sb.sb_blocklog, PAGE_CACHE_SIZE);
> + rounding = max_t(xfs_off_t, 1ULL << mp->m_sb.sb_blocklog, PAGE_CACHE_SIZE);
So it is safe the way it is and this is not necessary.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
prev parent reply other threads:[~2013-05-17 10:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-16 7:53 [patch] xfs: bug widening binary "not" operation Dan Carpenter
2013-05-16 23:03 ` Dave Chinner
2013-05-17 6:31 ` Dan Carpenter
2013-05-17 10:19 ` Dave Chinner [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=20130517101908.GS24635@dastard \
--to=david@fromorbit.com \
--cc=bpm@sgi.com \
--cc=dan.carpenter@oracle.com \
--cc=elder@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=xfs@oss.sgi.com \
/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