summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2024-01-10 08:42:06 +0300
committerJohannes Berg <johannes.berg@intel.com>2024-01-26 09:28:26 +0100
commit7f78840cf4d4ac9ab36ddf574a025a45835375d0 (patch)
tree8b6ce2358f830b1a0068f79334d0079b41affc66 /net
parent5f76499fb541c3e8ae401414bfdf702940c8c531 (diff)
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: Dmitry Antipov <dmantipov@yandex.ru> Link: https://msgid.link/20240110054246.371651-1-dmantipov@yandex.ru Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/wireless/mlme.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index f635a8b6ca2e..43ba7891e2a3 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -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);
}