From: Andrew Morton <akpm@linux-foundation.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: [bug report] [PATCH] sys_sync_file_range()
Date: Wed, 14 Mar 2018 12:56:57 -0700 [thread overview]
Message-ID: <20180314125657.53bd80c0c46fb868ade9326c@linux-foundation.org> (raw)
In-Reply-To: <20180314193621.GA2249@mwanda>
On Wed, 14 Mar 2018 22:36:21 +0300 Dan Carpenter <dan.carpenter@oracle.com> wrote:
> Hello Andrew Morton,
>
> The patch f79e2abb9bd4: "[PATCH] sys_sync_file_range()" from Mar 31,
> 2006, leads to the following static checker warning:
>
> fs/sync.c:298 ksys_sync_file_range()
> warn: signed overflow undefined. 'offset + nbytes < offset'
>
> fs/sync.c
> 279 int ksys_sync_file_range(int fd, loff_t offset, loff_t nbytes,
> 280 unsigned int flags)
> 281 {
> 282 int ret;
> 283 struct fd f;
> 284 struct address_space *mapping;
> 285 loff_t endbyte; /* inclusive */
> 286 umode_t i_mode;
> 287
> 288 ret = -EINVAL;
> 289 if (flags & ~VALID_FLAGS)
> 290 goto out;
> 291
> 292 endbyte = offset + nbytes;
> 293
> 294 if ((s64)offset < 0)
> 295 goto out;
> 296 if ((s64)endbyte < 0)
> 297 goto out;
> 298 if (endbyte < offset)
> ^^^^^^^^^^^^^^^^
> This is undefined but I think it works with the kernel build options?
>
Yup. -fno-strict-overflow. Please see Dmitry's explanation at
https://bugzilla.kernel.org/show_bug.cgi?id=199099.
prev parent reply other threads:[~2018-03-14 19:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-14 19:36 [bug report] [PATCH] sys_sync_file_range() Dan Carpenter
2018-03-14 19:56 ` Andrew Morton [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=20180314125657.53bd80c0c46fb868ade9326c@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=dan.carpenter@oracle.com \
--cc=linux-fsdevel@vger.kernel.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.