All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: "Christian König" <deathsimple@vodafone.de>
Cc: kernel-janitors@vger.kernel.org,
	"Michel Dänzer" <michel.daenzer@amd.com>,
	dri-devel@lists.freedesktop.org,
	"Jerome Glisse" <jglisse@redhat.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Dave Airlie" <airlied@redhat.com>
Subject: Re: [patch] drm/radeon: check for allocation failure in radeon_ring_backup()
Date: Fri, 20 Jul 2012 14:35:25 +0000	[thread overview]
Message-ID: <20120720143525.GE16291@mwanda> (raw)
In-Reply-To: <500960F8.6060906@vodafone.de>

On Fri, Jul 20, 2012 at 03:45:28PM +0200, Christian König wrote:
> On 20.07.2012 13:17, Dan Carpenter wrote:
> >Static checkers complain if this we don't check for allocation failure.
> >Also we can use the new kmalloc_array() function here as a cleanup.
> >
> >Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> What's the benefit of using kmalloc_array instead of just kmalloc?
> 

It has built in integer overflow protection.  Whenever I see
multiplication in kmalloc(), I automatically start to audit for
overflows, but now, ha ha, just change it to kmalloc_array() and
forget about it.  (There weren't any integer overflow problems
in the original code, btw).

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: "Christian König" <deathsimple@vodafone.de>
Cc: kernel-janitors@vger.kernel.org,
	"Michel Dänzer" <michel.daenzer@amd.com>,
	dri-devel@lists.freedesktop.org,
	"Jerome Glisse" <jglisse@redhat.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Dave Airlie" <airlied@redhat.com>
Subject: Re: [patch] drm/radeon: check for allocation failure in radeon_ring_backup()
Date: Fri, 20 Jul 2012 17:35:25 +0300	[thread overview]
Message-ID: <20120720143525.GE16291@mwanda> (raw)
In-Reply-To: <500960F8.6060906@vodafone.de>

On Fri, Jul 20, 2012 at 03:45:28PM +0200, Christian König wrote:
> On 20.07.2012 13:17, Dan Carpenter wrote:
> >Static checkers complain if this we don't check for allocation failure.
> >Also we can use the new kmalloc_array() function here as a cleanup.
> >
> >Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> What's the benefit of using kmalloc_array instead of just kmalloc?
> 

It has built in integer overflow protection.  Whenever I see
multiplication in kmalloc(), I automatically start to audit for
overflows, but now, ha ha, just change it to kmalloc_array() and
forget about it.  (There weren't any integer overflow problems
in the original code, btw).

regards,
dan carpenter

  reply	other threads:[~2012-07-20 14:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-20 11:17 [patch] drm/radeon: check for allocation failure in radeon_ring_backup() Dan Carpenter
2012-07-20 11:17 ` Dan Carpenter
2012-07-20 13:45 ` Christian König
2012-07-20 13:45   ` Christian König
2012-07-20 14:35   ` Dan Carpenter [this message]
2012-07-20 14:35     ` Dan Carpenter

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=20120720143525.GE16291@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=airlied@redhat.com \
    --cc=alexander.deucher@amd.com \
    --cc=deathsimple@vodafone.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jglisse@redhat.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=michel.daenzer@amd.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.