All of lore.kernel.org
 help / color / mirror / Atom feed
From: Willy Tarreau <w@1wt.eu>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: David Miller <davem@davemloft.net>,
	Eric Dumazet <eric.dumazet@gmail.com>,
	Network Development List <netdev@vger.kernel.org>
Subject: Re: [PATCH] nf_conntrack: avoid kernel pointer value leak in slab name
Date: Sat, 14 May 2016 23:33:22 +0200	[thread overview]
Message-ID: <20160514213322.GD9763@1wt.eu> (raw)
In-Reply-To: <CA+55aFx_PuzNC0riLEN7PUpVnvQg374ZqCYBV-Uw6Be-OA=DwQ@mail.gmail.com>

On Sat, May 14, 2016 at 02:31:04PM -0700, Linus Torvalds wrote:
> On Sat, May 14, 2016 at 11:24 AM, Linus Torvalds
> <torvalds@linux-foundation.org> wrote:
> >
> >
> > -       net->ct.slabname = kasprintf(GFP_KERNEL, "nf_conntrack_%p", net);
> > +       net->ct.slabname = kasprintf(GFP_KERNEL, "nf_conntrack_%llu",
> > +                               (u64)atomic64_inc_return(&unique_id));
> 
> Oh well. I suspect this is going to cause a new warning on alpha and
> ia64 and possibly others.
> 
> "u64" is indeed "unsigned long long" on x86 and many other
> architectures, but on alpga and ia64 it's just "unsigned long".
> 
> So that case should have been to "long long". I detest how there isn't
> a "64-bit size" printf specifier.

Why simply not cast the atomic to (unsigned long long) instead of (u64)
so that %llu always matches ?

Willy

  reply	other threads:[~2016-05-14 21:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-14 18:24 [PATCH] nf_conntrack: avoid kernel pointer value leak in slab name Linus Torvalds
2016-05-14 18:46 ` Eric Dumazet
2016-05-14 19:16 ` David Miller
2016-05-14 21:31 ` Linus Torvalds
2016-05-14 21:33   ` Willy Tarreau [this message]
2016-05-14 22:21     ` Linus Torvalds
2016-05-15  5:22       ` Willy Tarreau
2016-05-15 18:05   ` Linus Torvalds

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=20160514213322.GD9763@1wt.eu \
    --to=w@1wt.eu \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.