]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mac80211: fix ht_capa printout in debugfs
authorBen Greear <greearb@candelatech.com>
Wed, 6 Apr 2022 17:56:59 +0000 (10:56 -0700)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 11 Apr 2022 09:57:27 +0000 (11:57 +0200)
Don't use sizeof(pointer) when calculating scnprintf offset.

Fixes: 01f84f0ed3b4 ("mac80211: reduce stack usage in debugfs")
Signed-off-by: Ben Greear <greearb@candelatech.com>
Link: https://lore.kernel.org/r/20220406175659.20611-1-greearb@candelatech.com
[correct the Fixes tag]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/debugfs_sta.c

index 9479f2787ea79a1c466dddcea98de53d6b0a722e..88d9cc945a216c4f8b412b26965d37dbebd093fa 100644 (file)
@@ -441,7 +441,7 @@ static ssize_t sta_ht_capa_read(struct file *file, char __user *userbuf,
 #define PRINT_HT_CAP(_cond, _str) \
        do { \
        if (_cond) \
-                       p += scnprintf(p, sizeof(buf)+buf-p, "\t" _str "\n"); \
+                       p += scnprintf(p, bufsz + buf - p, "\t" _str "\n"); \
        } while (0)
        char *buf, *p;
        int i;