From: Sasha Levin <sasha.levin@oracle.com>
To: linux-kernel@vger.kernel.org
Cc: Sasha Levin <sasha.levin@oracle.com>,
linux-mm@kvack.org (open list:MEMORY MANAGEMENT)
Subject: [PATCH] mm: fadvise: avoid signed integer overflow calculating offset
Date: Mon, 1 Dec 2014 23:04:08 -0500 [thread overview]
Message-ID: <1417493050-13594-4-git-send-email-sasha.levin@oracle.com> (raw)
In-Reply-To: <1417493050-13594-1-git-send-email-sasha.levin@oracle.com>
Both offset and len are signed integers who's overflow isn't defined. Use
unsigned addition to avoid the issue.
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
mm/fadvise.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/fadvise.c b/mm/fadvise.c
index 3bcfd81d..762cb63 100644
--- a/mm/fadvise.c
+++ b/mm/fadvise.c
@@ -67,7 +67,7 @@ SYSCALL_DEFINE4(fadvise64_64, int, fd, loff_t, offset, loff_t, len, int, advice)
}
/* Careful about overflows. Len == 0 means "as much as possible" */
- endbyte = offset + len;
+ endbyte = offset + (u64)len;
if (!len || endbyte < len)
endbyte = -1;
else
--
1.7.10.4
next prev parent reply other threads:[~2014-12-02 4:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-02 4:04 [PATCH] time: do a safe overflow check in ktime_add_safe Sasha Levin
2014-12-02 4:04 ` [PATCH] time: make sure tz_minuteswest is set to a valid value when setting time Sasha Levin
2014-12-02 4:04 ` [PATCH] vfs: calculate seek offsets using unsigned variables Sasha Levin
2014-12-02 4:04 ` Sasha Levin [this message]
2014-12-02 4:04 ` [PATCH] time: settimeofday: validate the values of tv fomr user Sasha Levin
2014-12-02 11:16 ` Thomas Gleixner
2014-12-02 4:04 ` [PATCH] fs: sync_file_range: avoid overflowing signed calculation Sasha Levin
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=1417493050-13594-4-git-send-email-sasha.levin@oracle.com \
--to=sasha.levin@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®