* [PATCH] ufs: Remove redundant inode number check from ufs_nfs_get_inode
@ 2024-08-22 14:26 sergii.boryshchenko
2024-08-26 9:12 ` kernel test robot
2024-08-27 10:03 ` [PATCH v2] " sergii.boryshchenko
0 siblings, 2 replies; 3+ messages in thread
From: sergii.boryshchenko @ 2024-08-22 14:26 UTC (permalink / raw)
To: dushistov; +Cc: linux-nfs, linux-fsdevel, linux-kernel, Sergii Boryshchenko
From: Sergii Boryshchenko <sergii.boryshchenko@globallogic.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.
Signed-off-by: Sergii Boryshchenko <sergii.boryshchenko@globallogic.com>
---
fs/ufs/super.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index bc625788589c..11e8b869e0ba 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -101,9 +101,6 @@ static struct inode *ufs_nfs_get_inode(struct super_block *sb, u64 ino, u32 gene
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ufs: Remove redundant inode number check from ufs_nfs_get_inode
2024-08-22 14:26 [PATCH] ufs: Remove redundant inode number check from ufs_nfs_get_inode sergii.boryshchenko
@ 2024-08-26 9:12 ` kernel test robot
2024-08-27 10:03 ` [PATCH v2] " sergii.boryshchenko
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2024-08-26 9:12 UTC (permalink / raw)
To: sergii.boryshchenko, dushistov
Cc: oe-kbuild-all, linux-nfs, linux-fsdevel, linux-kernel,
Sergii Boryshchenko
Hi,
kernel test robot noticed the following build warnings:
[auto build test WARNING on linus/master]
[also build test WARNING on viro-vfs/for-next v6.11-rc5 next-20240823]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/sergii-boryshchenko-globallogic-com/ufs-Remove-redundant-inode-number-check-from-ufs_nfs_get_inode/20240826-120030
base: linus/master
patch link: https://lore.kernel.org/r/20240822142610.129668-1-sergii.boryshchenko%40globallogic.com
patch subject: [PATCH] ufs: Remove redundant inode number check from ufs_nfs_get_inode
config: arc-randconfig-001-20240826 (https://download.01.org/0day-ci/archive/20240826/202408261605.ARxTA9jX-lkp@intel.com/config)
compiler: arc-elf-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240826/202408261605.ARxTA9jX-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408261605.ARxTA9jX-lkp@intel.com/
All warnings (new ones prefixed by >>):
fs/ufs/super.c: In function 'ufs_nfs_get_inode':
>> fs/ufs/super.c:101:37: warning: unused variable 'uspi' [-Wunused-variable]
101 | struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi;
| ^~~~
vim +/uspi +101 fs/ufs/super.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 98
f3e2a520f5fb1a Alexey Dobriyan 2009-12-15 99 static struct inode *ufs_nfs_get_inode(struct super_block *sb, u64 ino, u32 generation)
f3e2a520f5fb1a Alexey Dobriyan 2009-12-15 100 {
f3e2a520f5fb1a Alexey Dobriyan 2009-12-15 @101 struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi;
f3e2a520f5fb1a Alexey Dobriyan 2009-12-15 102 struct inode *inode;
f3e2a520f5fb1a Alexey Dobriyan 2009-12-15 103
f3e2a520f5fb1a Alexey Dobriyan 2009-12-15 104 inode = ufs_iget(sb, ino);
f3e2a520f5fb1a Alexey Dobriyan 2009-12-15 105 if (IS_ERR(inode))
f3e2a520f5fb1a Alexey Dobriyan 2009-12-15 106 return ERR_CAST(inode);
f3e2a520f5fb1a Alexey Dobriyan 2009-12-15 107 if (generation && inode->i_generation != generation) {
f3e2a520f5fb1a Alexey Dobriyan 2009-12-15 108 iput(inode);
f3e2a520f5fb1a Alexey Dobriyan 2009-12-15 109 return ERR_PTR(-ESTALE);
f3e2a520f5fb1a Alexey Dobriyan 2009-12-15 110 }
f3e2a520f5fb1a Alexey Dobriyan 2009-12-15 111 return inode;
f3e2a520f5fb1a Alexey Dobriyan 2009-12-15 112 }
f3e2a520f5fb1a Alexey Dobriyan 2009-12-15 113
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2] ufs: Remove redundant inode number check from ufs_nfs_get_inode
2024-08-22 14:26 [PATCH] ufs: Remove redundant inode number check from ufs_nfs_get_inode sergii.boryshchenko
2024-08-26 9:12 ` kernel test robot
@ 2024-08-27 10:03 ` sergii.boryshchenko
1 sibling, 0 replies; 3+ messages in thread
From: sergii.boryshchenko @ 2024-08-27 10:03 UTC (permalink / raw)
To: dushistov
Cc: linux-nfs, linux-fsdevel, linux-kernel, Sergii Boryshchenko,
kernel test robot
From: Sergii Boryshchenko <sergii.boryshchenko@globallogic.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@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408261605.ARxTA9jX-lkp@intel.com/
Signed-off-by: Sergii Boryshchenko <sergii.boryshchenko@globallogic.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
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-27 10:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-22 14:26 [PATCH] ufs: Remove redundant inode number check from ufs_nfs_get_inode sergii.boryshchenko
2024-08-26 9:12 ` kernel test robot
2024-08-27 10:03 ` [PATCH v2] " sergii.boryshchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).