The return value of snprintf was used incorrectly (given as param to simple_read_from_buffer, without checking it against max buffer size). use scnprintf instead. Signed-off-by: Eliad Peller <eliad@xxxxxxxxxx> --- net/wireless/debugfs.c | 25 ++++++++++++------------- 1 files changed, 12 insertions(+), 13 deletions(-) diff --git a/net/wireless/debugfs.c b/net/wireless/debugfs.c index 920cabe..fa669c7 100644 --- a/net/wireless/debugfs.c +++ b/net/wireless/debugfs.c @@ -43,21 +43,20 @@ DEBUGFS_READONLY_FILE(long_retry_limit, 20, "%d", static int ht_print_chan(struct ieee80211_channel *chan, char *buf, int buf_size, int offset) { - if (WARN_ON(offset > buf_size)) - return 0; - - if (chan->flags & IEEE80211_CHAN_DISABLED) - return snprintf(buf + offset, - buf_size - offset, - "%d Disabled\n", - chan->center_freq); - - return snprintf(buf + offset, - buf_size - offset, - "%d HT40 %c%c\n", - chan->center_freq, - (chan->flags & IEEE80211_CHAN_NO_HT40MINUS) ? ' ' : '-', - (chan->flags & IEEE80211_CHAN_NO_HT40PLUS) ? ' ' : '+'); + u32 flags = chan->flags; + + if (flags & IEEE80211_CHAN_DISABLED) + return scnprintf(buf + offset, + buf_size - offset, + "%d Disabled\n", + chan->center_freq); + + return scnprintf(buf + offset, + buf_size - offset, + "%d HT40 %c%c\n", + chan->center_freq, + (flags & IEEE80211_CHAN_NO_HT40MINUS) ? ' ' : '-', + (flags & IEEE80211_CHAN_NO_HT40PLUS) ? ' ' : '+'); } static ssize_t ht40allow_map_read(struct file *file, -- 1.7.6.401.g6a319 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html