Commit 7f78840c authored by Dmitry Antipov's avatar Dmitry Antipov Committed by Johannes Berg

wifi: wireless: avoid strlen() in cfg80211_michael_mic_failure()

In 'cfg80211_michael_mic_failure()', avoid extra call to 'strlen()'
by using the value returned by 'sprintf()'. Compile tested only.
Signed-off-by: default avatarDmitry Antipov <dmantipov@yandex.ru>
Link: https://msgid.link/20240110054246.371651-1-dmantipov@yandex.ruSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 5f76499f
......@@ -241,12 +241,12 @@ void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
char *buf = kmalloc(128, gfp);
if (buf) {
sprintf(buf, "MLME-MICHAELMICFAILURE.indication("
"keyid=%d %scast addr=%pM)", key_id,
key_type == NL80211_KEYTYPE_GROUP ? "broad" : "uni",
addr);
memset(&wrqu, 0, sizeof(wrqu));
wrqu.data.length = strlen(buf);
wrqu.data.length =
sprintf(buf, "MLME-MICHAELMICFAILURE."
"indication(keyid=%d %scast addr=%pM)",
key_id, key_type == NL80211_KEYTYPE_GROUP
? "broad" : "uni", addr);
wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
kfree(buf);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment