[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20111123215111.GD3258@mwanda>
Date: Thu, 24 Nov 2011 00:51:11 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Lars-Peter Clausen <lars@...afoo.de>
Cc: Ian Abbott <abbotti@....co.uk>, Xi Wang <xi.wang@...il.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
Mori Hess <fmhess@...rs.sourceforge.net>,
"security@...nel.org" <security@...nel.org>,
Lucas De Marchi <lucas.demarchi@...fusion.mobi>,
Greg Kroah-Hartman <gregkh@...e.de>,
Ian Abbott <ian.abbott@....co.uk>,
Franky Lin <frankyl@...adcom.com>,
Greg Dietsche <Gregory.Dietsche@....edu>,
Mark Pearson <markpearson_de@...oo.de>
Subject: Re: [PATCH] comedi: integer overflow in do_insnlist_ioctl()
On Wed, Nov 23, 2011 at 10:41:07PM +0100, Lars-Peter Clausen wrote:
> > if (insnlist.n_insns <= ULONG_MAX / sizeof(struct comedi_insn))
> > insns =
> > kmalloc(sizeof(struct comedi_insn) * insnlist.n_insns,
> > GFP_KERNEL);
> > if (!insns)
> > ...
> >
> > (note that insns is initialized to NULL).
> >
>
> Just use kcalloc, it will do the right thing for you.
>
I think the reason why I didn't do that in my original patch is that
kcalloc() has a memset(..., 0, ...) in it so it's a slow down. But
this isn't performance critical code so that would work.
regards,
dan carpenter
Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)
Powered by blists - more mailing lists