public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Austin Kim <austindh.kim@gmail.com>
To: dhowells@redhat.com
Cc: linux-cachefs@redhat.com, linux-kernel@vger.kernel.org,
	austin.kim@lge.com
Subject: [PATCH] cachefiles: remove always false 'datalen < 0' expression
Date: Tue, 24 Aug 2021 04:18:47 +0100	[thread overview]
Message-ID: <20210824031847.GA23326@raspberrypi> (raw)

From: Austin Kim <austin.kim@lge.com>

Since 'datalen' is declared as size_t, the 'datalen < 0' expression
is always false. Where size_t is defined as below;

   typedef unsigned long __kernel_ulong_t;
   typedef __kernel_ulong_t __kernel_size_t;
   typedef __kernel_size_t size_t;

So it had better remove unnecessary 'always false' expression.

Signed-off-by: Austin Kim <austin.kim@lge.com>
---
 fs/cachefiles/daemon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/cachefiles/daemon.c b/fs/cachefiles/daemon.c
index 752c1e43416f..1cfed9e0812a 100644
--- a/fs/cachefiles/daemon.c
+++ b/fs/cachefiles/daemon.c
@@ -225,7 +225,7 @@ static ssize_t cachefiles_daemon_write(struct file *file,
 	if (test_bit(CACHEFILES_DEAD, &cache->flags))
 		return -EIO;
 
-	if (datalen < 0 || datalen > PAGE_SIZE - 1)
+	if (datalen > PAGE_SIZE - 1)
 		return -EOPNOTSUPP;
 
 	/* drag the command string into the kernel so we can parse it */
-- 
2.20.1


             reply	other threads:[~2021-08-24  3:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-24  3:18 Austin Kim [this message]
2021-11-03  8:15 ` [PATCH] cachefiles: remove always false 'datalen < 0' expression Austin Kim

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=20210824031847.GA23326@raspberrypi \
    --to=austindh.kim@gmail.com \
    --cc=austin.kim@lge.com \
    --cc=dhowells@redhat.com \
    --cc=linux-cachefs@redhat.com \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox