linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
To: bcrl@kvack.org
Cc: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org,
	Yuanhan Liu <yuanhan.liu@linux.intel.com>
Subject: [PATCH] aio: remove 'always false' check
Date: Wed, 11 Jul 2012 17:15:22 +0800	[thread overview]
Message-ID: <1341998122-9521-1-git-send-email-yuanhan.liu@linux.intel.com> (raw)

The only case that nr_pages will be < 0 is that nr_pages overflowed due
to nr_events is too big. But it is exclued at ioctx_alloc().

Thus, nr_pages will always > 0. So remove the dead 'if (nr_pages < 0)'
code block.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
 fs/aio.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/fs/aio.c b/fs/aio.c
index 55c4c76..7248327 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -117,10 +117,6 @@ static int aio_setup_ring(struct kioctx *ctx)
 	size = sizeof(struct aio_ring);
 	size += sizeof(struct io_event) * nr_events;
 	nr_pages = (size + PAGE_SIZE-1) >> PAGE_SHIFT;
-
-	if (nr_pages < 0)
-		return -EINVAL;
-
 	nr_events = (PAGE_SIZE * nr_pages - sizeof(struct aio_ring)) / sizeof(struct io_event);
 
 	info->nr = 0;
-- 
1.7.7.6


             reply	other threads:[~2012-07-11  9:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-11  9:15 Yuanhan Liu [this message]
2012-07-11 14:17 ` [PATCH] aio: remove 'always false' check Jeff Moyer
2012-07-13  1:35   ` Yuanhan Liu

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=1341998122-9521-1-git-send-email-yuanhan.liu@linux.intel.com \
    --to=yuanhan.liu@linux.intel.com \
    --cc=bcrl@kvack.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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).