From: Dan Carpenter <dan.carpenter@oracle.com>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Ian Abbott <abbotti@mev.co.uk>, Xi Wang <xi.wang@gmail.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
Mori Hess <fmhess@users.sourceforge.net>,
"security@kernel.org" <security@kernel.org>,
Lucas De Marchi <lucas.demarchi@profusion.mobi>,
Greg Kroah-Hartman <gregkh@suse.de>,
Ian Abbott <ian.abbott@mev.co.uk>,
Franky Lin <frankyl@broadcom.com>,
Greg Dietsche <Gregory.Dietsche@cuw.edu>,
Mark Pearson <markpearson_de@yahoo.de>
Subject: Re: [PATCH] comedi: integer overflow in do_insnlist_ioctl()
Date: Thu, 24 Nov 2011 00:51:11 +0300 [thread overview]
Message-ID: <20111123215111.GD3258@mwanda> (raw)
In-Reply-To: <4ECD6873.7080106@metafoo.de>
[-- Attachment #1: Type: text/plain, Size: 657 bytes --]
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
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2011-11-23 21:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-23 0:49 [PATCH] comedi: integer overflow in do_insnlist_ioctl() Xi Wang
2011-11-23 6:13 ` Dan Carpenter
2011-11-23 13:59 ` Xi Wang
2011-11-23 14:50 ` Dan Carpenter
2011-11-23 16:06 ` Ian Abbott
2011-11-23 16:53 ` [PATCH v2] " Xi Wang
2011-11-23 21:41 ` [PATCH] " Lars-Peter Clausen
2011-11-23 21:51 ` Dan Carpenter [this message]
2011-11-24 19:07 ` Xi Wang
2011-11-25 7:25 ` Dan Carpenter
2011-11-25 21:46 ` [PATCH v3] " Xi Wang
2011-11-27 2:52 ` Greg KH
2011-11-27 11:25 ` Dan Carpenter
2011-11-27 21:24 ` Greg KH
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=20111123215111.GD3258@mwanda \
--to=dan.carpenter@oracle.com \
--cc=Gregory.Dietsche@cuw.edu \
--cc=abbotti@mev.co.uk \
--cc=devel@driverdev.osuosl.org \
--cc=fmhess@users.sourceforge.net \
--cc=frankyl@broadcom.com \
--cc=gregkh@suse.de \
--cc=ian.abbott@mev.co.uk \
--cc=lars@metafoo.de \
--cc=linux-kernel@vger.kernel.org \
--cc=lucas.demarchi@profusion.mobi \
--cc=markpearson_de@yahoo.de \
--cc=security@kernel.org \
--cc=xi.wang@gmail.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 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.