]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
cachefiles: Clean up some check-unsigned-for-negative
authorDavid Howells <dhowells@redhat.com>
Sun, 31 Oct 2021 12:58:05 +0000 (12:58 +0000)
committerDavid Howells <dhowells@redhat.com>
Fri, 26 Nov 2021 09:16:12 +0000 (09:16 +0000)
Clean up some places where unsigned values are checked to see if they're
negative.

Signed-off-by: David Howells <dhowells@redhat.com>
fs/cachefiles/bind.c
fs/cachefiles/daemon.c

index d463d89f5db8cc55d9c69af81a77ae2bc735aa05..7b46d25f13abdd96d95cb140317691f1e75ea203 100644 (file)
@@ -36,13 +36,11 @@ int cachefiles_daemon_bind(struct cachefiles_cache *cache, char *args)
               args);
 
        /* start by checking things over */
-       ASSERT(cache->fstop_percent >= 0 &&
-              cache->fstop_percent < cache->fcull_percent &&
+       ASSERT(cache->fstop_percent < cache->fcull_percent &&
               cache->fcull_percent < cache->frun_percent &&
               cache->frun_percent  < 100);
 
-       ASSERT(cache->bstop_percent >= 0 &&
-              cache->bstop_percent < cache->bcull_percent &&
+       ASSERT(cache->bstop_percent < cache->bcull_percent &&
               cache->bcull_percent < cache->brun_percent &&
               cache->brun_percent  < 100);
 
index 752c1e43416f507aa7fcb4969fa025762186dfbc..24b1797653fd3ab0b633fec5c142133c0f8c3483 100644 (file)
@@ -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 */
@@ -382,7 +382,7 @@ static int cachefiles_daemon_fstop(struct cachefiles_cache *cache, char *args)
        if (args[0] != '%' || args[1] != '\0')
                return -EINVAL;
 
-       if (fstop < 0 || fstop >= cache->fcull_percent)
+       if (fstop >= cache->fcull_percent)
                return cachefiles_daemon_range_error(cache, args);
 
        cache->fstop_percent = fstop;
@@ -454,7 +454,7 @@ static int cachefiles_daemon_bstop(struct cachefiles_cache *cache, char *args)
        if (args[0] != '%' || args[1] != '\0')
                return -EINVAL;
 
-       if (bstop < 0 || bstop >= cache->bcull_percent)
+       if (bstop >= cache->bcull_percent)
                return cachefiles_daemon_range_error(cache, args);
 
        cache->bstop_percent = bstop;