public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: Fix compiler warnings in blk-merge.c
@ 2015-09-06 15:24 Geliang Tang
  2015-09-08 15:19 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Geliang Tang @ 2015-09-06 15:24 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Geliang Tang, linux-kernel

Fix the following warnings:

  CC      block/blk-merge.o
In file included from block/blk-merge.c:7:0:
block/blk-merge.c: In function ‘blk_queue_split’:
include/linux/blkdev.h:1368:21: warning: ‘bvprv.bv_offset’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
   ((bprv->bv_offset + bprv->bv_len) & queue_virt_boundary(q));
                     ^
block/blk-merge.c:70:21: note: ‘bvprv.bv_offset’ was declared here
  struct bio_vec bv, bvprv;
                     ^
In file included from block/blk-merge.c:7:0:
include/linux/blkdev.h:1368:21: warning: ‘bvprv.bv_len’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
   ((bprv->bv_offset + bprv->bv_len) & queue_virt_boundary(q));
                     ^
block/blk-merge.c:70:21: note: ‘bvprv.bv_len’ was declared here
  struct bio_vec bv, bvprv;
                     ^
In file included from ./arch/x86/include/asm/page.h:70:0,
                 from ./arch/x86/include/asm/thread_info.h:11,
                 from include/linux/thread_info.h:54,
                 from ./arch/x86/include/asm/preempt.h:6,
                 from include/linux/preempt.h:64,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:35,
                 from include/linux/time.h:5,
                 from include/linux/stat.h:18,
                 from include/linux/module.h:10,
                 from block/blk-merge.c:5:
include/asm-generic/memory_model.h:52:52: warning: ‘bvprv.bv_page’ may
be used uninitialized in this function [-Wmaybe-uninitialized]
 #define __page_to_pfn(page) (unsigned long)((page) - vmemmap)
                                                    ^
block/blk-merge.c:70:21: note: ‘bvprv.bv_page’ was declared here
  struct bio_vec bv, bvprv;
                     ^

Signed-off-by: Geliang Tang <geliangtang@163.com>
---
 block/blk-merge.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/blk-merge.c b/block/blk-merge.c
index d088cff..5bd84c8 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -67,7 +67,7 @@ static struct bio *blk_bio_segment_split(struct request_queue *q,
 					 struct bio_set *bs)
 {
 	struct bio *split;
-	struct bio_vec bv, bvprv;
+	struct bio_vec bv, bvprv = { NULL };
 	struct bvec_iter iter;
 	unsigned seg_size = 0, nsegs = 0, sectors = 0;
 	int prev = 0;
-- 
2.3.4



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] block: Fix compiler warnings in blk-merge.c
  2015-09-06 15:24 [PATCH] block: Fix compiler warnings in blk-merge.c Geliang Tang
@ 2015-09-08 15:19 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2015-09-08 15:19 UTC (permalink / raw)
  To: Geliang Tang; +Cc: linux-kernel

On 09/06/2015 09:24 AM, Geliang Tang wrote:
> Fix the following warnings:
>
>    CC      block/blk-merge.o
> In file included from block/blk-merge.c:7:0:
> block/blk-merge.c: In function ‘blk_queue_split’:
> include/linux/blkdev.h:1368:21: warning: ‘bvprv.bv_offset’ may be used
> uninitialized in this function [-Wmaybe-uninitialized]
>     ((bprv->bv_offset + bprv->bv_len) & queue_virt_boundary(q));
>                       ^
> block/blk-merge.c:70:21: note: ‘bvprv.bv_offset’ was declared here
>    struct bio_vec bv, bvprv;
>                       ^
> In file included from block/blk-merge.c:7:0:
> include/linux/blkdev.h:1368:21: warning: ‘bvprv.bv_len’ may be used
> uninitialized in this function [-Wmaybe-uninitialized]
>     ((bprv->bv_offset + bprv->bv_len) & queue_virt_boundary(q));
>                       ^
> block/blk-merge.c:70:21: note: ‘bvprv.bv_len’ was declared here
>    struct bio_vec bv, bvprv;
>                       ^
> In file included from ./arch/x86/include/asm/page.h:70:0,
>                   from ./arch/x86/include/asm/thread_info.h:11,
>                   from include/linux/thread_info.h:54,
>                   from ./arch/x86/include/asm/preempt.h:6,
>                   from include/linux/preempt.h:64,
>                   from include/linux/spinlock.h:50,
>                   from include/linux/seqlock.h:35,
>                   from include/linux/time.h:5,
>                   from include/linux/stat.h:18,
>                   from include/linux/module.h:10,
>                   from block/blk-merge.c:5:
> include/asm-generic/memory_model.h:52:52: warning: ‘bvprv.bv_page’ may
> be used uninitialized in this function [-Wmaybe-uninitialized]
>   #define __page_to_pfn(page) (unsigned long)((page) - vmemmap)
>                                                      ^
> block/blk-merge.c:70:21: note: ‘bvprv.bv_page’ was declared here
>    struct bio_vec bv, bvprv;

There's already a fix queued up for that, which doesn't require bvprv to 
be cleared to 0:

http://git.kernel.dk/cgit/linux-block/commit/?h=for-linus&id=5014c311baa2b21384321fa4a9f617a92e3e56f0

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-08 15:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-06 15:24 [PATCH] block: Fix compiler warnings in blk-merge.c Geliang Tang
2015-09-08 15:19 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox