🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
2 messages
2 total messages Started by Chelsy Ratnawat Thu, 15 Oct 2026 20:01
[PATCH] net/rxrpc: Simplify rxrpcpeerseq_next()
#3723
Author: Chelsy Ratnawat
Date: Thu, 15 Oct 2026 20:01
38 lines
8577 bytes
Remove the redundant initialization and conditional handling of n,
as it is always set to 1. Use the constant directly when updating
*_pos and starting the hlist iteration.

Signed-off-by: Chelsy Ratnawat <chelsyratnawat2001@gmail.com>
---
 net/rxrpc/proc.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/net/rxrpc/proc.c b/net/rxrpc/proc.c
index e9a27fa7b25d..608670dc97d9 100644
--- a/net/rxrpc/proc.c
+++ b/net/rxrpc/proc.c
@@ -367,19 +367,14 @@ static void *rxrpc_peer_seq_next(struct seq_file *seq, void *v, loff_t *_pos)
 
 	for (;;) {
 		bucket++;
-		n = 1;
-		*_pos = (bucket << shift) | n;
+		*_pos = (bucket << shift) | 1;
 
 		if (bucket >= HASH_SIZE(rxnet->peer_hash)) {
 			*_pos = UINT_MAX;
 			return NULL;
 		}
-		if (n == 0) {
-			*_pos += 1;
-			n++;
-		}
 
-		p = seq_hlist_start_rcu(&rxnet->peer_hash[bucket], n - 1);
+		p = seq_hlist_start_rcu(&rxnet->peer_hash[bucket], 0);
 		if (p)
 			return p;
 	}
-- 
2.53.0
Re: [PATCH] net/rxrpc: Simplify rxrpcpeerseq_next()
#3853
Author: kernel test robot
Date: Fri, 16 Oct 2026 05:59
70 lines
10280 bytes
Hi Chelsy,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]
[also build test WARNING on net/main linus/master dhowells-fs/fscache-next dhowells-fs/keys-next v7.3-rc7 next-20261012]
[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/Chelsy-Ratnawat/net-rxrpc-Simplify-rxrpcpeerseq_next/20261015-130115
base:   net-next/main
patch link:    https://lore.kernel.org/r/20261015200115.59571-1-chelsyratnawat2001%40gmail.com
patch subject: [PATCH] net/rxrpc: Simplify rxrpcpeerseq_next()
config: nios2-randconfig-1000-20261016 (https://download.01.org/0day-ci/archive/20261016/202610161338.9QHAZ7bn-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 11.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261016/202610161338.9QHAZ7bn-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/202610161338.9QHAZ7bn-lkp@intel.com/

All warnings (new ones prefixed by >>):

   net/rxrpc/proc.c: In function 'rxrpc_peer_seq_next':
>> net/rxrpc/proc.c:355:30: warning: unused variable 'n' [-Wunused-variable]
     355 |         unsigned int bucket, n;
         |                              ^


vim +/n +355 net/rxrpc/proc.c

bc0e7cf43370a8e David Howells   2018-10-15  351  
bc0e7cf43370a8e David Howells   2018-10-15  352  static void *rxrpc_peer_seq_next(struct seq_file *seq, void *v, loff_t *_pos)
bc0e7cf43370a8e David Howells   2018-10-15  353  {
bc0e7cf43370a8e David Howells   2018-10-15  354  	struct rxrpc_net *rxnet = rxrpc_net(seq_file_net(seq));
bc0e7cf43370a8e David Howells   2018-10-15 @355  	unsigned int bucket, n;
bc0e7cf43370a8e David Howells   2018-10-15  356  	unsigned int shift = 32 - HASH_BITS(rxnet->peer_hash);
bc0e7cf43370a8e David Howells   2018-10-15  357  	void *p;
bc0e7cf43370a8e David Howells   2018-10-15  358  
bc0e7cf43370a8e David Howells   2018-10-15  359  	if (*_pos >= UINT_MAX)
bc0e7cf43370a8e David Howells   2018-10-15  360  		return NULL;
bc0e7cf43370a8e David Howells   2018-10-15  361  
bc0e7cf43370a8e David Howells   2018-10-15  362  	bucket = *_pos >> shift;
bc0e7cf43370a8e David Howells   2018-10-15  363  
bc0e7cf43370a8e David Howells   2018-10-15  364  	p = seq_hlist_next_rcu(v, &rxnet->peer_hash[bucket], _pos);
bc0e7cf43370a8e David Howells   2018-10-15  365  	if (p)
bc0e7cf43370a8e David Howells   2018-10-15  366  		return p;
bc0e7cf43370a8e David Howells   2018-10-15  367  
bc0e7cf43370a8e David Howells   2018-10-15  368  	for (;;) {
bc0e7cf43370a8e David Howells   2018-10-15  369  		bucket++;
da940c1bf91ae9e Chelsy Ratnawat 2026-10-15  370  		*_pos = (bucket << shift) | 1;
bc0e7cf43370a8e David Howells   2018-10-15  371  
bc0e7cf43370a8e David Howells   2018-10-15  372  		if (bucket >= HASH_SIZE(rxnet->peer_hash)) {
bc0e7cf43370a8e David Howells   2018-10-15  373  			*_pos = UINT_MAX;
bc0e7cf43370a8e David Howells   2018-10-15  374  			return NULL;
bc0e7cf43370a8e David Howells   2018-10-15  375  		}
bc0e7cf43370a8e David Howells   2018-10-15  376  
da940c1bf91ae9e Chelsy Ratnawat 2026-10-15  377  		p = seq_hlist_start_rcu(&rxnet->peer_hash[bucket], 0);
bc0e7cf43370a8e David Howells   2018-10-15  378  		if (p)
bc0e7cf43370a8e David Howells   2018-10-15  379  			return p;
bc0e7cf43370a8e David Howells   2018-10-15  380  	}
bc0e7cf43370a8e David Howells   2018-10-15  381  }
bc0e7cf43370a8e David Howells   2018-10-15  382  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads