From: "Jesper Juhl" <jesper.juhl@gmail.com>
To: "Jan Engelhardt" <jengelh@computergmbh.de>
Cc: Denys Vlasenko <vda.linux@googlemail.com>,
David Woodhouse <dwmw2@infradead.org>,
linux-mtd@lists.infradead.org,
"Robert P. J. Day" <rpjday@mindspring.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 09/30] mtd: Don't cast kmalloc() return value in drivers/mtd/maps/pmcmsp-flash.c
Date: Mon, 27 Aug 2007 00:10:17 +0200 [thread overview]
Message-ID: <9a8748490708261510u6f373d2s760bef86e81bbe02@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0708261635080.15614@fbirervta.pbzchgretzou.qr>
On 26/08/07, Jan Engelhardt <jengelh@computergmbh.de> wrote:
>
> On Aug 26 2007 15:28, Denys Vlasenko wrote:
> >> >
> >> > What exactely would using kcalloc() over kzalloc() here buy us?
> >>
> >> technically, nothing.
> >
> >The idea of calloc is that it can check for underflow in parameter.
>
> Actually, overflow.
>
> calloc(0xFFFF0000, 0x1000) => will return NULL
> malloc(0xFFFF0000 * 0x1000) => silent 32 bit multiplication/truncation,
> will allocate less than requested.
>
> >calloc(-1, 10000000) => easy to detect
> >malloc(-1 * 10000000) => malloc(-10000000) => not so trivial
>
Ok, that makes a bit of sense. Thank you.
--
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
next prev parent reply other threads:[~2007-08-26 22:10 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1554af80879a7ef2f78a4d654f23c248203500d9.1187912217.git.jesper.juhl@gmail.com>
2007-08-23 23:50 ` [PATCH 07/30] mtd: Get rid of pointless cast of kzalloc() return value in AT26xxx driver Jesper Juhl
2007-08-23 23:51 ` [PATCH 08/30] mtd: Avoid a pointless kmalloc() return value cast in TQM8xxL mapping handling code Jesper Juhl
2007-08-23 23:52 ` [PATCH 09/30] mtd: Don't cast kmalloc() return value in drivers/mtd/maps/pmcmsp-flash.c Jesper Juhl
2007-08-24 10:41 ` Denys Vlasenko
2007-08-24 10:43 ` Robert P. J. Day
2007-08-25 22:27 ` Jesper Juhl
2007-08-25 23:59 ` Robert P. J. Day
2007-08-26 0:28 ` Jesper Juhl
2007-08-26 0:23 ` Robert P. J. Day
2007-08-26 0:36 ` Jesper Juhl
2007-08-26 1:52 ` Kyle Moffett
2007-08-26 14:28 ` Denys Vlasenko
2007-08-26 14:37 ` Jan Engelhardt
2007-08-26 22:10 ` Jesper Juhl [this message]
2007-08-24 10:48 ` Jesper Juhl
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=9a8748490708261510u6f373d2s760bef86e81bbe02@mail.gmail.com \
--to=jesper.juhl@gmail.com \
--cc=dwmw2@infradead.org \
--cc=jengelh@computergmbh.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=rpjday@mindspring.com \
--cc=vda.linux@googlemail.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