git: 64313140e531 - stable/13 - iee80211_hwmp: Don't dereference NULL ni in debug printf.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Wed, 03 May 2023 00:29:45 UTC
The branch stable/13 has been updated by jhb:

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

commit 64313140e531622eaa5e858e8d22c663efb83d19
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-12-21 18:45:45 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-05-03 00:12:50 +0000

    iee80211_hwmp: Don't dereference NULL ni in debug printf.
    
    In this call to IEEE80211_NOTE, ni is always NULL due to the assignment
    a few lines earlier at the start of the function.  If debug traces are
    enabled, then this will pass an invalid pointer as the 'mac' pointer to
    ieee80211_note_mac.  Use IEEE80211_DPRINTF which doesn't take a 'ni'
    argument instead.
    
    Reported by:    GCC -Wstringop-overread
    Reviewed by:    bz, emaste
    Differential Revision:  https://reviews.freebsd.org/D37626
    
    (cherry picked from commit 95d146592f5ee3fa998496713f28475e65996ff9)
---
 sys/net80211/ieee80211_hwmp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/net80211/ieee80211_hwmp.c b/sys/net80211/ieee80211_hwmp.c
index 77ba218ccd50..ad3de543664f 100644
--- a/sys/net80211/ieee80211_hwmp.c
+++ b/sys/net80211/ieee80211_hwmp.c
@@ -1928,8 +1928,8 @@ hwmp_discover(struct ieee80211vap *vap,
 		if (rt == NULL) {
 			rt = ieee80211_mesh_rt_add(vap, dest);
 			if (rt == NULL) {
-				IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP,
-				    ni, "unable to add discovery path to %6D",
+				IEEE80211_DPRINTF(vap, IEEE80211_MSG_HWMP,
+				    "unable to add discovery path to %6D",
 				    dest, ":");
 				vap->iv_stats.is_mesh_rtaddfailed++;
 				goto done;