All of lore.kernel.org
 help / color / mirror / Atom feed
From: Firo Yang <firogm@gmail.com>
To: viro@zeniv.linux.org.uk
Cc: kernel-janitors@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Firo Yang <firogm@gmail.com>
Subject: [PATCH] fs/compat: remove redundant 'less than zero' check
Date: Fri, 24 Apr 2015 10:07:50 +0000	[thread overview]
Message-ID: <1429870070-30310-1-git-send-email-firogm@gmail.com> (raw)

Smatch complains about the check in compat.c.
fs/compat.c:565 compat_rw_copy_check_uvector() warn:
unsigned 'nr_segs' is never less than zero.

I think, there is no reason to check if the value nr_segs
is less than zero. So I removed it.

Signed-off-by: Firo Yang <firogm@gmail.com>
---
 fs/compat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/compat.c b/fs/compat.c
index 6fd272d..beaf15b 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -562,7 +562,7 @@ ssize_t compat_rw_copy_check_uvector(int type,
 		goto out;
 
 	ret = -EINVAL;
-	if (nr_segs > UIO_MAXIOV || nr_segs < 0)
+	if (nr_segs > UIO_MAXIOV)
 		goto out;
 	if (nr_segs > fast_segs) {
 		ret = -ENOMEM;
-- 
2.1.0


WARNING: multiple messages have this Message-ID (diff)
From: Firo Yang <firogm@gmail.com>
To: viro@zeniv.linux.org.uk
Cc: kernel-janitors@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Firo Yang <firogm@gmail.com>
Subject: [PATCH] fs/compat: remove redundant 'less than zero' check
Date: Fri, 24 Apr 2015 18:07:50 +0800	[thread overview]
Message-ID: <1429870070-30310-1-git-send-email-firogm@gmail.com> (raw)

Smatch complains about the check in compat.c.
fs/compat.c:565 compat_rw_copy_check_uvector() warn:
unsigned 'nr_segs' is never less than zero.

I think, there is no reason to check if the value nr_segs
is less than zero. So I removed it.

Signed-off-by: Firo Yang <firogm@gmail.com>
---
 fs/compat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/compat.c b/fs/compat.c
index 6fd272d..beaf15b 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -562,7 +562,7 @@ ssize_t compat_rw_copy_check_uvector(int type,
 		goto out;
 
 	ret = -EINVAL;
-	if (nr_segs > UIO_MAXIOV || nr_segs < 0)
+	if (nr_segs > UIO_MAXIOV)
 		goto out;
 	if (nr_segs > fast_segs) {
 		ret = -ENOMEM;
-- 
2.1.0


             reply	other threads:[~2015-04-24 10:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-24 10:07 Firo Yang [this message]
2015-04-24 10:07 ` [PATCH] fs/compat: remove redundant 'less than zero' check Firo Yang
2015-04-24 10:10 ` Julia Lawall
2015-04-24 10:10   ` Julia Lawall
     [not found]   ` <CAOXNuu2VKCWNSiePoSw4-G3TqxpXDE9fR75B75-fhQLa-SPcJg@mail.gmail.com>
2015-04-24 10:29     ` Julia Lawall
2015-04-24 10:29       ` Julia Lawall
2015-04-24 12:04 ` Dan Carpenter
2015-04-24 12:04   ` Dan Carpenter
2015-04-24 12:23   ` Julia Lawall
2015-04-24 12:23     ` Julia Lawall
2015-04-24 13:00     ` Dan Carpenter
2015-04-24 13:00       ` Dan Carpenter

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=1429870070-30310-1-git-send-email-firogm@gmail.com \
    --to=firogm@gmail.com \
    --cc=kernel-janitors@vger.kernel.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 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.