Skip to contentSkip to conversation

block: kmalloc args reversed, small function definition fixes

PATCH In review Harvey Harrison 3 participants 5 messages Aug 27, 2008 – Aug 28, 2008 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: kmalloc args reversed, small function definition fixes

Noticed by sparse:
block/blk-softirq.c:156:12: warning: symbol 'blk_softirq_init' was not declared. Should it be static? block/genhd.c:583:28: warning: function 'bdget_disk' with external linkage has definition block/genhd.c:659:17: warning: incorrect type in argument 1 (different base types)
block/genhd.c:659:17: expected unsigned int [unsigned] [usertype] size
block/genhd.c:659:17: got restricted gfp_t
block/genhd.c:659:29: warning: incorrect type in argument 2 (different base types)
block/genhd.c:659:29: expected restricted gfp_t [usertype] flags
block/genhd.c:659:29: got unsigned int
block: kmalloc args reversed

---
new in next-20080827

 block/blk-settings.c |    2 +-
 block/genhd.c        |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
block/blk-settings.c +1 -1
index a60e959..d70692b 100644
@@ -443,7 +443,7 @@ void blk_queue_update_dma_alignment(struct request_queue *q, int mask)
 }
 EXPORT_SYMBOL(blk_queue_update_dma_alignment);
 
-int __init blk_settings_init(void)
+static int __init blk_settings_init(void)
 {
 	blk_max_low_pfn = max_low_pfn - 1;
 	blk_max_pfn = max_pfn - 1;
block/genhd.c +2 -2
index a189358..e2eaaa3 100644
@@ -580,7 +580,7 @@ struct gendisk *get_gendisk(dev_t devt, int *partno)
  * RETURNS:
  * Resulting block_device on success, NULL on failure.
  */
-extern struct block_device *bdget_disk(struct gendisk *disk, int partno)
+struct block_device *bdget_disk(struct gendisk *disk, int partno)
 {
 	struct hd_struct *part;
 	struct block_device *bdev = NULL;
@@ -656,7 +656,7 @@ static void *disk_seqf_start(struct seq_file *seqf, loff_t *pos)
 	struct class_dev_iter *iter;
 	struct device *dev;
 
-	iter = kmalloc(GFP_KERNEL, sizeof(*iter));
+	iter = kmalloc(sizeof(*iter), GFP_KERNEL);
 	if (!iter)
 		return ERR_PTR(-ENOMEM);
 
Signature · 1 line
1.6.0.366.gf9ffa8
#1 lore raw
Quoted 10 lines · Harvey Harrison

Noticed by sparse:
block/blk-softirq.c:156:12: warning: symbol 'blk_softirq_init' was not declared. Should it be static? block/genhd.c:583:28: warning: function 'bdget_disk' with external linkage has definition block/genhd.c:659:17: warning: incorrect type in argument 1 (different base types)
block/genhd.c:659:17: expected unsigned int [unsigned] [usertype] size
block/genhd.c:659:17: got restricted gfp_t
block/genhd.c:659:29: warning: incorrect type in argument 2 (different base types)
block/genhd.c:659:29: expected restricted gfp_t [usertype] flags
block/genhd.c:659:29: got unsigned int
block: kmalloc args reversed

Woops, that kmalloc() is nasty. Thanks a lot, applied to for-2.6.28.

Signature · 1 line
Jens Axboe
#2 lore raw
Quoted 12 lines · Jens Axboe
Quoted 10 lines · Harvey Harrison

Noticed by sparse:
block/blk-softirq.c:156:12: warning: symbol 'blk_softirq_init' was not declared. Should it be static? block/genhd.c:583:28: warning: function 'bdget_disk' with external linkage has definition block/genhd.c:659:17: warning: incorrect type in argument 1 (different base types)
block/genhd.c:659:17: expected unsigned int [unsigned] [usertype] size
block/genhd.c:659:17: got restricted gfp_t
block/genhd.c:659:29: warning: incorrect type in argument 2 (different base types)
block/genhd.c:659:29: expected restricted gfp_t [usertype] flags
block/genhd.c:659:29: got unsigned int
block: kmalloc args reversed

Quoted 1 line

Woops, that kmalloc() is nasty. Thanks a lot, applied to for-2.6.28.

Umm, the gfp bit sounds like a clear 2.6.27 candidate.

#3 lore raw
Quoted 13 lines · Christoph Hellwig
Quoted 12 lines · Jens Axboe
Quoted 10 lines · Harvey Harrison

Noticed by sparse:
block/blk-softirq.c:156:12: warning: symbol 'blk_softirq_init' was not declared. Should it be static? block/genhd.c:583:28: warning: function 'bdget_disk' with external linkage has definition block/genhd.c:659:17: warning: incorrect type in argument 1 (different base types)
block/genhd.c:659:17: expected unsigned int [unsigned] [usertype] size
block/genhd.c:659:17: got restricted gfp_t
block/genhd.c:659:29: warning: incorrect type in argument 2 (different base types)
block/genhd.c:659:29: expected restricted gfp_t [usertype] flags
block/genhd.c:659:29: got unsigned int
block: kmalloc args reversed

Quoted 3 lines
Quoted 1 line

Woops, that kmalloc() is nasty. Thanks a lot, applied to for-2.6.28.

Umm, the gfp bit sounds like a clear 2.6.27 candidate.

I would agree, except the bug is introduced by a patch in the 2.6.28 series :-)

Signature · 1 line
Jens Axboe
#4 lore raw
Quoted 6 lines · Jens Axboe
Quoted 3 lines
Quoted 1 line

Woops, that kmalloc() is nasty. Thanks a lot, applied to for-2.6.28.

Umm, the gfp bit sounds like a clear 2.6.27 candidate.

I would agree, except the bug is introduced by a patch in the 2.6.28 series :-)

Ah, okay. Makes sense then.