The branch stable/13 has been updated by markj:

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

commit 178633e28291d2e4168e51e6d970c25bca43bc1e
Author:     Mark Johnston <ma...@freebsd.org>
AuthorDate: 2021-05-12 14:05:37 +0000
Commit:     Mark Johnston <ma...@freebsd.org>
CommitDate: 2021-05-19 13:32:11 +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
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit ad22ba2b9f3b6ff5d85be14627d3a59ca389f5e4)
---
 sys/net/if.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/sys/net/if.c b/sys/net/if.c
index 776fcf2fc78d..f6926c43ef96 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -2663,11 +2663,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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"

Reply via email to