mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: WANG Cong <xiyou.wangcong@gmail.com>
Cc: Satyam Sharma <satyam@infradead.org>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	jack@hawkeye.stone.uk.eu.org, linux-kernel@vger.kernel.org,
	trivial@kernel.org
Subject: Re: [Patch 09/16] Remove unnecessary kmalloc casts in the pci subsystem.
Date: Tue, 31 Jul 2007 09:10:51 -0700	[thread overview]
Message-ID: <20070731161051.GA7490@suse.de> (raw)
In-Reply-To: <20070731144619.GA8183@localhost.localdomain>

On Tue, Jul 31, 2007 at 10:46:19PM +0800, WANG Cong wrote:
> On Tue, Jul 31, 2007 at 08:00:12PM +0530, Satyam Sharma wrote:
> >
> >
> >On Tue, 31 Jul 2007, Christian Borntraeger wrote:
> >
> >> Am Dienstag, 31. Juli 2007 schrieb jack@hawkeye.stone.uk.eu.org:
> >> > --- a/drivers/pci/rom.c
> >> > +++ b/drivers/pci/rom.c
> >> > @@ -185,7 +185,7 @@ void __iomem *pci_map_rom_copy(struct pc
> >> >  			  IORESOURCE_ROM_BIOS_COPY))
> >> >  		return rom;
> >> > 
> >> > -	res->start = (unsigned long)kmalloc(*size, GFP_KERNEL);
> >> > +	res->start = kmalloc(*size, GFP_KERNEL);
> >> 
> >> This looks wrong.
> >
> >Yup, a warning at the very least.
> >
> >> void * doesnt need a cast to a pointer, but res->start is an 
> >> integer u32 type,
> >
> >It better not be, else we have a bug already anyway. Pointers are 64-bit
> >on 64-bit archs. [ it turns out res->start is resource_size_t which is
> >set properly as per CONFIG_RESOURCES_64BIT which itself is set properly
> >as per CONFIG_64BIT, so everything is healthy and fine :-) ]
> >
> 
> I agree.
> 
> However, I think using resource_size_t is a bit better than unsigned long,
> so that we don't need to check the defination of it.
> 
> - res->start = (unsigned long)kmalloc(*size, GFP_KERNEL);
> + res->start = (resource_size_t)kmalloc(*size, GFP_KERNEL);
> 
> Is this change OK?

Yes, that is the proper cast to have here.

thanks,

greg k-h

  parent reply	other threads:[~2007-07-31 16:11 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-31 12:53 [Patch 00/16] Remove unnecessary kmalloc casts jack
2007-07-31 12:53 ` [Patch 01/16] Remove unnecessary kmalloc casts from the cris arch jack
2007-08-01  1:06   ` Stefan Richter
2007-07-31 12:53 ` [Patch 02/16] Remove unnecessary kmalloc casts from the mips arch jack
2007-07-31 14:15   ` Christian Borntraeger
2007-07-31 15:15   ` Rene Herman
2007-07-31 12:53 ` [Patch 03/16] Remove unnecessary kmalloc casts from the powerpc arch jack
2007-07-31 12:53 ` [Patch 04/16] Remove unnecessary kmalloc casts from the sparc arch jack
2007-07-31 14:09   ` WANG Cong
2007-07-31 12:53 ` [Patch 05/16] Remove unnecessary kmalloc casts in the drivers subdirectory jack
2007-08-01  0:53   ` Stefan Richter
2007-07-31 12:53 ` [Patch 06/16] This removes unnecessary kmalloc casts and corrects a test for kmalloc failure jack
2007-07-31 14:17   ` Christian Borntraeger
2007-07-31 12:53 ` [Patch 07/16] Remove unnecessary kmalloc casts in the mtd drivers jack
2007-07-31 12:53 ` [Patch 08/16] Remove unnecessary kmalloc casts in the parisc drivers jack
2007-07-31 14:06   ` Christian Borntraeger
2007-07-31 12:53 ` [Patch 09/16] Remove unnecessary kmalloc casts in the pci subsystem jack
2007-07-31 13:53   ` Christian Borntraeger
2007-07-31 14:30     ` Satyam Sharma
2007-07-31 14:46       ` WANG Cong
2007-07-31 16:05         ` Satyam Sharma
2007-07-31 16:10         ` Greg KH [this message]
2007-07-31 16:20           ` Andreas Schwab
2007-07-31 17:47             ` Greg KH
2007-07-31 18:06               ` Satyam Sharma
2007-08-01  4:02               ` Paul Mackerras
2007-07-31 20:19     ` David Miller
2007-07-31 12:53 ` [Patch 10/16] Remove unnecessary kmalloc casts in the irda drivers jack
2007-07-31 12:53 ` [Patch 11/16] Remove unnecessary kmalloc casts in drivers/net jack
2007-07-31 14:16   ` Christian Borntraeger
2007-07-31 12:53 ` [Patch 12/16] Remove unnecessary kmalloc casts in the libertas drivers jack
2007-07-31 12:53 ` [Patch 13/16] Remove needless kmalloc casts in the wireless drivers jack
2007-07-31 12:53 ` [Patch 14/16] Remove needless kmalloc casts in the zd1211rw drivers jack
2007-07-31 14:18   ` Daniel Drake
2007-08-01  1:11     ` Stefan Richter
2007-08-01  2:09       ` Daniel Drake
2007-07-31 12:53 ` [Patch 15/16] Remove unnecesary kmalloc casts in the scsi drivers jack
2007-07-31 14:20   ` James Bottomley
2007-07-31 12:53 ` [Patch 16/16] Remove unnecessary kmalloc casts in the jfs filesystem jack
2007-07-31 13:14   ` Dave Kleikamp

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=20070731161051.GA7490@suse.de \
    --to=gregkh@suse.de \
    --cc=borntraeger@de.ibm.com \
    --cc=jack@hawkeye.stone.uk.eu.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=satyam@infradead.org \
    --cc=trivial@kernel.org \
    --cc=xiyou.wangcong@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome