[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20240827100313.171877-1-sergii.boryshchenko@globallogic.com>
Date: Tue, 27 Aug 2024 13:03:13 +0300
From: sergii.boryshchenko@...ballogic.com
To: dushistov@...l.ru
Cc: linux-nfs@...r.kernel.org,
linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org,
Sergii Boryshchenko <sergii.boryshchenko@...ballogic.com>,
kernel test robot <lkp@...el.com>
Subject: [PATCH v2] ufs: Remove redundant inode number check from ufs_nfs_get_inode
From: Sergii Boryshchenko <sergii.boryshchenko@...ballogic.com>
The `ufs_nfs_get_inode` function contains a check to validate the inode number
(`ino`) against the valid range of inode numbers. However, this check is
redundant because the same validation is already performed in the `ufs_iget`
function, which is called immediately afterward.
By removing this redundant check, we simplify the code and avoid unnecessary
double-checking of the inode number, while still ensuring that invalid inode
numbers are properly handled by the `ufs_iget` function.
This change has no impact on the functionality since `ufs_iget` provides the
necessary validation for all callers.
Changes since v1:
- Removed the unused variable 'uspi' as reported by the kernel test robot.
Reported-by: kernel test robot <lkp@...el.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408261605.ARxTA9jX-lkp@intel.com/
Signed-off-by: Sergii Boryshchenko <sergii.boryshchenko@...ballogic.com>
---
fs/ufs/super.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index bc625788589c..3511d35b7b21 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -98,12 +98,8 @@
static struct inode *ufs_nfs_get_inode(struct super_block *sb, u64 ino, u32 generation)
{
- struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi;
struct inode *inode;
- if (ino < UFS_ROOTINO || ino > (u64)uspi->s_ncg * uspi->s_ipg)
- return ERR_PTR(-ESTALE);
-
inode = ufs_iget(sb, ino);
if (IS_ERR(inode))
return ERR_CAST(inode);
--
2.25.1
Powered by blists - more mailing lists