]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mm: shmem: remove duplicate error validation
authorBaolin Wang <baolin.wang@linux.alibaba.com>
Fri, 7 Feb 2025 09:44:19 +0000 (17:44 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 17 Mar 2025 07:05:42 +0000 (00:05 -0700)
Remove duplicate error code checks for 'start' and 'end', as the
get_order_from_str() will only return -EINVAL if the cmdline string is
configured incorrectly.

Link: https://lkml.kernel.org/r/dfadaba4c8b24c5ae1467fe8b6744b654c65ec91.1738918357.git.baolin.wang@linux.alibaba.com
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/shmem.c

index c63fd18cea50a29e1c2c9cb8e31554c3fc4d06f9..51bdeea828a0917f01bc930d9db6ca2054a4dbfc 100644 (file)
@@ -5664,19 +5664,19 @@ static int __init setup_thp_shmem(char *str)
                                                                 THP_ORDERS_ALL_FILE_DEFAULT);
                        }
 
-                       if (start == -EINVAL) {
+                       if (start < 0) {
                                pr_err("invalid size %s in thp_shmem boot parameter\n",
                                       start_size);
                                goto err;
                        }
 
-                       if (end == -EINVAL) {
+                       if (end < 0) {
                                pr_err("invalid size %s in thp_shmem boot parameter\n",
                                       end_size);
                                goto err;
                        }
 
-                       if (start < 0 || end < 0 || start > end)
+                       if (start > end)
                                goto err;
 
                        nr = end - start + 1;