mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Paul Menzel <pmenzel+linux-wireless@molgen.mpg.de>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	it+linux-wireless@molgen.mpg.de,
	Mario Limonciello <mario.limonciello@dell.com>,
	Thorsten Leemhuis <linux@leemhuis.info>
Subject: Re: UBSAN: Undefined behaviour in net/wireless/nl80211.c:718:4: -1665903437 * 100 cannot be represented in type 'int'
Date: Thu, 04 Jan 2018 16:08:34 +0100	[thread overview]
Message-ID: <1515078514.10342.29.camel@sipsolutions.net> (raw)
In-Reply-To: <f58ac367-9b22-a7dc-7d45-7e9d19e179c0@molgen.mpg.de>

Hi,

Can you reproduce this?

> [   54.426491] UBSAN: Undefined behaviour in net/wireless/nl80211.c:718:4
> [   54.426492] signed integer overflow:
> [   54.426493] -1665903437 * 100 cannot be represented in type 'int'

Obviously.

However, it looks like the real reason is that there's some garbage (-
1665903437) in chan->max_power, which is just stack memory being leaked
out...

This should help?

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 78e71b0390be..7b42f0bacfd8 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1769,8 +1769,7 @@ static void handle_reg_beacon(struct wiphy *wiphy, unsigned int chan_idx,
 	if (wiphy->regulatory_flags & REGULATORY_DISABLE_BEACON_HINTS)
 		return;
 
-	chan_before.center_freq = chan->center_freq;
-	chan_before.flags = chan->flags;
+	chan_before = *chan;
 
 	if (chan->flags & IEEE80211_CHAN_NO_IR) {
 		chan->flags &= ~IEEE80211_CHAN_NO_IR;

johannes

  parent reply	other threads:[~2018-01-04 15:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-03 16:20 Paul Menzel
2018-01-03 16:25 ` Mario.Limonciello
2018-01-04 15:08 ` Johannes Berg [this message]
2018-01-17 12:22   ` Paul Menzel
2018-01-17 13:12     ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1515078514.10342.29.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=it+linux-wireless@molgen.mpg.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linux@leemhuis.info \
    --cc=mario.limonciello@dell.com \
    --cc=pmenzel+linux-wireless@molgen.mpg.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®