Skip to content

net: deduplicate netdev name allocation

Jakub Kicinski netdev 2 versions – Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest6 patches 1 replyApplied 6/6
  2. v16 patches 10 repliesSuperseded

Patches in v2 All 6 applied

#Subject and filesSizeRepliesApplied
1/6net: don't use input buffer of __dev_alloc_name() as a scratch spacenet/core/dev.c+8 -250 repliesApplied
2/6net: make dev_alloc_name() call dev_prep_valid_name()net/core/dev.c+11 -90 repliesApplied
3/6net: reduce indentation of __dev_alloc_name()net/core/dev.c+26 -300 repliesApplied
4/6net: trust the bitmap in __dev_alloc_name()net/core/dev.c+4 -111 replyApplied
5/6net: remove dev_valid_name() check from __dev_alloc_name()net/core/dev.c+0 -30 repliesApplied
6/6net: remove else after return in dev_prep_valid_name()net/core/dev.c+5 -60 repliesApplied

Reviews trailers per patch

All 6 patches have a Reviewed-by or Acked-by.

PatchJiri Pirko
1/6R-b
2/6R-b
3/6R-b
4/6R-b
5/6R-b
6/6R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH net-next v2 0/6] net: deduplicate netdev name allocation

After recent fixes we have even more duplicated code in netdev name
allocation helpers. There are two complications in this code.
First, __dev_alloc_name() clobbers its output arg even if allocation
fails, forcing callers to do extra copies. Second as our experience in
commit 55a5ec9b7710 ("Revert "net: core: dev_get_valid_name is now the same as dev_alloc_name_ns"") and commit 029b6d140550 ("Revert "net: core: maybe return -EEXIST in __dev_alloc_name"") taught us, user space is very sensitive to the exact error codes.

Align the callers of __dev_alloc_name(), and remove some of its complexity.

v2: extend commit message on patch 4
v1: https://lore.kernel.org/all/[email protected]/

Jakub Kicinski (6):
net: don't use input buffer of __dev_alloc_name() as a scratch space
net: make dev_alloc_name() call dev_prep_valid_name()
net: reduce indentation of __dev_alloc_name()
net: trust the bitmap in __dev_alloc_name()
net: remove dev_valid_name() check from __dev_alloc_name()
net: remove else after return in dev_prep_valid_name()

 net/core/dev.c | 120 +++++++++++++++++++------------------------------
 1 file changed, 45 insertions(+), 75 deletions(-)
Signature · 1 line
2.41.0