mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Luruo, Kuthonuzo" <kuthonuzo.luruo@hpe.com>
To: Alexander Potapenko <glider@google.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>,
	Dmitriy Vyukov <dvyukov@google.com>,
	Christoph Lameter <cl@linux.com>,
	"penberg@kernel.org" <penberg@kernel.org>,
	"rientjes@google.com" <rientjes@google.com>,
	"Joonsoo Kim" <iamjoonsoo.kim@lge.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	kasan-dev <kasan-dev@googlegroups.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"ynorov@caviumnetworks.com" <ynorov@caviumnetworks.com>
Subject: RE: [PATCH v4 2/2] kasan: add double-free tests
Date: Tue, 7 Jun 2016 18:10:53 +0000	[thread overview]
Message-ID: <DF4PR84MB00896C65CECA9D8B7EC6179EF45D0@DF4PR84MB0089.NAMPRD84.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <CAG_fn=Uk4MBEHp2h4DULOue6ELLbno+61ww3MZfzf-Txwqvy7w@mail.gmail.com>

> > +       int cpu, cnt = num_online_cpus();
> > +       cpumask_t mask = { CPU_BITS_NONE };
> > +       size_t size = 4097;     /* must be <= KMALLOC_MAX_CACHE_SIZE/2 */
> Can you please explicitly calculate |size| from KMALLOC_MAX_CACHE_SIZE?
> > +
> > +       if (cnt == 1)
> > +               return;
> > +       cnt = cnt < MAX_THREADS ? cnt : MAX_THREADS;
> > +       pr_info("concurrent double-free (%d threads)\n", cnt);
> > +       p = kmalloc(size, GFP_KERNEL);
> > +       if (!p)
> > +               return;
> > +       for_each_online_cpu(cpu) {
> > +               cpumask_set_cpu(cpu, &mask);
> > +               if (!--cnt)
> > +                       break;
> > +       }
> > +       on_each_cpu_mask(&mask, try_free, p, 0);
> > +}
> > +
> > +static noinline void __init kasan_double_free(void)
> > +{
> > +       char *p;
> > +       size_t size = 2049;
> Please avoid using magic constants.

Alexander,

Thanks very much for the review.  I've changed alloc size for both to 100
in v5.

Kuthonuzo

      reply	other threads:[~2016-06-07 18:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-29 16:17 Kuthonuzo Luruo
2016-06-07 14:02 ` Alexander Potapenko
2016-06-07 18:10   ` Luruo, Kuthonuzo [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=DF4PR84MB00896C65CECA9D8B7EC6179EF45D0@DF4PR84MB0089.NAMPRD84.PROD.OUTLOOK.COM \
    --to=kuthonuzo.luruo@hpe.com \
    --cc=akpm@linux-foundation.org \
    --cc=aryabinin@virtuozzo.com \
    --cc=cl@linux.com \
    --cc=dvyukov@google.com \
    --cc=glider@google.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=ynorov@caviumnetworks.com \
    /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®