LVS
lvs-devel
Google
 
Web LinuxVirtualServer.org

[Question] Dead code in __ip_vs_init() net init functions?

To: lvs-devel@xxxxxxxxxxxxxxx
Subject: [Question] Dead code in __ip_vs_init() net init functions?
Cc: horms@xxxxxxxxxxxx, ja@xxxxxx, netdev@xxxxxxxxxxxxxxx, Ingyu Jang <ingyujang25@xxxxxxxxxxx>
From: Ingyu Jang <ingyujang25@xxxxxxxxxxx>
Date: Sat, 31 Jan 2026 17:11:07 +0900
Hi,

I noticed that in net/netfilter/ipvs/ip_vs_core.c, the function
__ip_vs_init() checks the return values of two initialization functions:

  - ip_vs_estimator_net_init()
  - ip_vs_sync_net_init()

However, both functions always return 0:

  ip_vs_estimator_net_init() in ip_vs_est.c only initializes struct
  fields and calls __mutex_init(), then returns 0.

  ip_vs_sync_net_init() in ip_vs_sync.c only calls __mutex_init()
  and spin_lock_init(), then returns 0.

The error handling code (goto estimator_fail, goto sync_fail) can
never be reached.

Is this intentional defensive coding for potential future changes
(e.g., adding memory allocation), or could this be cleaned up?

Thanks,
Ingyu Jang


<Prev in Thread] Current Thread [Next in Thread>
  • [Question] Dead code in __ip_vs_init() net init functions?, Ingyu Jang <=