public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Greg KH' <gregkh@linuxfoundation.org>,
	'Eric Biggers' <ebiggers@kernel.org>
Cc: 'Tetsuo Handa' <penguin-kernel@i-love.sakura.ne.jp>,
	"'gustavo@embeddedor.com'" <gustavo@embeddedor.com>,
	"'linux-kernel@vger.kernel.org'" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] hpet: Fix struct_size() in kzalloc()
Date: Thu, 30 Jan 2020 10:37:07 +0000	[thread overview]
Message-ID: <69fae096f556414c96a71747f49d1e08@AcuMS.aculab.com> (raw)
In-Reply-To: <b04253f40d9e49e597af925599bd4964@AcuMS.aculab.com>

> ...
> > > > -	hpetp = kzalloc(struct_size(hpetp, hp_dev, hdp->hd_nirqs - 1),
> > > > +	hpetp = kzalloc(struct_size(hpetp, hp_dev, hdp->hd_nirqs),
> > > >  			GFP_KERNEL);
> > > >
> > > >  	if (!hpetp)
> > > > --
> > >
> > > Yep, "char: hpet: Use flexible-array member" started causing random boot
> > > failures on mainline for me.  Tetsuo beat me to sending the fix.
> > >
> > > Only thing I'll add is that GFP_KERNEL can now fit on the previous line.
> >
> > Gustavo already sent a fix for this, I didn't realize it was causing
> > boot problems, I'll forward it on to Linus soon.
> 
> grep -r --include '*.c' 'struct_size.*- 1'
> gives 4 other matches.
> I bet they all have the same bug.
> There might be others that simple pattern doesn't find.

kvm_main.c is ok - although why it reallocates 1 entry smaller on
    delete is any bodies guess.
megaraid_sas_fusion.c is broken, header has seq[1]
   (and lots of __packed).
iavf_virtchnl.c is broken, header has list[1].
ice_sched.c is broken, header has generic[1].

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


      reply	other threads:[~2020-01-30 10:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-30  4:50 [PATCH] hpet: Fix struct_size() in kzalloc() Tetsuo Handa
2020-01-30  5:26 ` Eric Biggers
2020-01-30  5:56   ` Greg KH
2020-01-30 10:09     ` David Laight
2020-01-30 10:37       ` David Laight [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=69fae096f556414c96a71747f49d1e08@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=ebiggers@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavo@embeddedor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    /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