Netdev Archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: "Jannik Glückert" <jannik.glueckert@gmail.com>
Cc: Bagas Sanjaya <bagasdotme@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Networking <netdev@vger.kernel.org>,
	 Linux Wireless <linux-wireless@vger.kernel.org>,
	Jouni Malinen <jouni.malinen@atheros.com>,
	"John W. Linville" <linville@tuxdriver.com>,
	Kalle Valo <kvalo@kernel.org>,
	Emmanuel Grumbach <emmanuel.grumbach@intel.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	 Sam James <sam@gentoo.org>
Subject: Re: Fwd: UBSAN: array-index-out-of-bounds in net/wireless/nl80211.c and net/mac80211/scan.c
Date: Thu, 09 May 2024 12:52:56 +0200	[thread overview]
Message-ID: <161df39ee89ae640828d3226a8de3d60f786ddd7.camel@sipsolutions.net> (raw)
In-Reply-To: <CAFqe=z+bnNayKaxEnEFar28Q__yZ9Byaxe3YwtMaBEsASG2VwA@mail.gmail.com>

On Thu, 2024-05-09 at 12:49 +0200, Jannik Glückert wrote:
> 
> > (Seriously. If you're running with bleeding edge toolchains that pretty
> > much nobody has yet, send patches.)
> 
> I'm not sure what to make of this - this bug has been around ever
> since the code was added, modern toolchains just happen to be one way
> to expose it.

No, that's incorrect. This is perfectly valid code:

 struct x {
   int n;
   int a[] /* __counted_by(n) */;
 };

 x = alloc(sizeof(*x) + sizeof(int) * 2);
 x->a[0] = 10;
 x->a[1] = 20;
 x->n = 2;

However, the uncommenting of the __counted_by() annotation will lead to
a complaint.

johannes

      reply	other threads:[~2024-05-09 10:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-09  0:07 Fwd: UBSAN: array-index-out-of-bounds in net/wireless/nl80211.c and net/mac80211/scan.c Bagas Sanjaya
2024-05-09  8:48 ` Johannes Berg
2024-05-09  9:17   ` Bagas Sanjaya
2024-05-09 10:49   ` Jannik Glückert
2024-05-09 10:52     ` Johannes Berg [this message]

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=161df39ee89ae640828d3226a8de3d60f786ddd7.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=bagasdotme@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=emmanuel.grumbach@intel.com \
    --cc=jannik.glueckert@gmail.com \
    --cc=jouni.malinen@atheros.com \
    --cc=kuba@kernel.org \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sam@gentoo.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).