The branch main has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=ad22ba2b9f3b6ff5d85be14627d3a59ca389f5e4

commit ad22ba2b9f3b6ff5d85be14627d3a59ca389f5e4
Author:     Mark Johnston <ma...@freebsd.org>
AuthorDate: 2021-05-12 14:05:37 +0000
Commit:     Mark Johnston <ma...@freebsd.org>
CommitDate: 2021-05-12 16:52:06 +0000

    if: Remove unnecessary validation in the SIOCSIFNAME handler
    
    A successful copyinstr() call guarantees that the returned string is
    nul-terminated.  Furthermore, the removed check would harmlessly compare
    an uninitialized byte with '\0' if the new name is shorter than
    IFNAMESIZ - 1.
    
    Reported by:    KMSAN
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
---
 sys/net/if.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/sys/net/if.c b/sys/net/if.c
index e18ed3e275ac..f615d82636be 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -2653,11 +2653,6 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, 
struct thread *td)
                        return (error);
                if (new_name[0] == '\0')
                        return (EINVAL);
-               if (new_name[IFNAMSIZ-1] != '\0') {
-                       new_name[IFNAMSIZ-1] = '\0';
-                       if (strlen(new_name) == IFNAMSIZ-1)
-                               return (EINVAL);
-               }
                if (strcmp(new_name, ifp->if_xname) == 0)
                        break;
                if (ifunit(new_name) != NULL)
_______________________________________________
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"

Reply via email to