* [Question] Dead code in rawv6_mh_filter_register()?
@ 2026-01-31 15:02 Ingyu Jang
2026-01-31 18:04 ` Jakub Kicinski
0 siblings, 1 reply; 2+ messages in thread
From: Ingyu Jang @ 2026-01-31 15:02 UTC (permalink / raw)
To: netdev; +Cc: davem, dsahern, edumazet, Ingyu Jang
Hi,
I noticed that in net/ipv6/raw.c, the function
rawv6_mh_filter_register() always returns 0.
The function (at line 117) simply performs:
- rcu_assign_pointer(mh_filter, filter)
- return 0
However, in net/ipv6/mip6.c, the function mip6_init() checks the
return value and has error handling (at line 381):
if (rawv6_mh_filter_register(mip6_mh_filter) < 0) {
pr_info("%s: can't add rawv6 mh filter\n", __func__);
goto mip6_rawv6_mh_fail;
}
Since rawv6_mh_filter_register() never fails, this error path
appears to be dead code. The same applies to
rawv6_mh_filter_unregister() in mip6_fini().
Is this intentional defensive coding for potential future changes,
or could this be cleaned up by making these functions return void?
Thanks,
Ingyu Jang
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Question] Dead code in rawv6_mh_filter_register()?
2026-01-31 15:02 [Question] Dead code in rawv6_mh_filter_register()? Ingyu Jang
@ 2026-01-31 18:04 ` Jakub Kicinski
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2026-01-31 18:04 UTC (permalink / raw)
To: Ingyu Jang; +Cc: netdev, davem, dsahern, edumazet
On Sun, 1 Feb 2026 00:02:12 +0900 Ingyu Jang wrote:
> Since rawv6_mh_filter_register() never fails, this error path
> appears to be dead code. The same applies to
> rawv6_mh_filter_unregister() in mip6_fini().
Please do not send such reports for networking.
register and alloc functions should always be assumed to
need error handling, so that we don't have to fix all
the callers once they do and check why there's no error
checking when reviewing the code..
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-01-31 18:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-31 15:02 [Question] Dead code in rawv6_mh_filter_register()? Ingyu Jang
2026-01-31 18:04 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox