Skip to contentSkip to conversation

xen-blkfront: Silence pfn maybe-uninitialized warning

PATCH In review Tim Gardner 3 participants 7 messages Nov 14, 2013 – Nov 15, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen-blkfront: Silence pfn maybe-uninitialized warning

pfn cannot actually be used unless (!info->feature_persistent), nor is pfn accessed in get_grant() unless (!info->feature_persistent), but silence this warning anyway. gcc-4.8

drivers/block/xen-blkfront.c: In function 'do_blkif_request':
drivers/block/xen-blkfront.c:508:20: warning: 'pfn' may be used uninitialized in this function [-Wmaybe-uninitialized]

     gnt_list_entry = get_grant(&gref_head, pfn, info);
                    ^
drivers/block/xen-blkfront.c:492:19: note: 'pfn' was declared here
     unsigned long pfn;
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc David Vrabel <[email protected]>
---
 drivers/block/xen-blkfront.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/xen-blkfront.c +1 -1
index 432db1b..5f926de 100644
@@ -489,7 +489,7 @@ static int blkif_queue_request(struct request *req)
 
 			if ((ring_req->operation == BLKIF_OP_INDIRECT) &&
 			    (i % SEGS_PER_INDIRECT_FRAME == 0)) {
-				unsigned long pfn;
+				unsigned long uninitialized_var(pfn);
 
 				if (segments)
 					kunmap_atomic(segments);
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 27 lines · Tim Gardner

pfn cannot actually be used unless (!info->feature_persistent), nor is pfn accessed in get_grant() unless (!info->feature_persistent), but silence
this warning anyway. gcc-4.8

drivers/block/xen-blkfront.c: In function 'do_blkif_request':
drivers/block/xen-blkfront.c:508:20: warning: 'pfn' may be used uninitialized in this function [-Wmaybe-uninitialized]

    gnt_list_entry = get_grant(&gref_head, pfn, info);
                   ^
drivers/block/xen-blkfront.c:492:19: note: 'pfn' was declared here
    unsigned long pfn;
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc David Vrabel <[email protected]>

---
drivers/block/xen-blkfront.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/xen-blkfront.c +0 -0
index 432db1b..5f926de 100644

drivers/block/xen-blkfront.c static int blkif_queue_request(struct request *req) · line 495

Quoted 8 lines
drivers/block/xen-blkfront.c +1 -1
@@ -489,7 +489,7 @@ static int blkif_queue_request(struct request *req)
 
 			if ((ring_req->operation == BLKIF_OP_INDIRECT) &&
 			    (i % SEGS_PER_INDIRECT_FRAME == 0)) {
-				unsigned long pfn;
+				unsigned long uninitialized_var(pfn);
 
 				if (segments)
 					kunmap_atomic(segments);

I have a similar patch from Roger that sets pfn=0.

Roger could you repost your patch please or if you feel that this patch makes sense then comment on it?

Thanks.

#2 lore raw
In reply to Tim Gardner
Quoted 27 lines · Tim Gardner

pfn cannot actually be used unless (!info->feature_persistent), nor is pfn accessed in get_grant() unless (!info->feature_persistent), but silence
this warning anyway. gcc-4.8

drivers/block/xen-blkfront.c: In function 'do_blkif_request':
drivers/block/xen-blkfront.c:508:20: warning: 'pfn' may be used uninitialized in this function [-Wmaybe-uninitialized]

    gnt_list_entry = get_grant(&gref_head, pfn, info);
                   ^
drivers/block/xen-blkfront.c:492:19: note: 'pfn' was declared here
    unsigned long pfn;
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc David Vrabel <[email protected]>

---
drivers/block/xen-blkfront.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/xen-blkfront.c +0 -0
index 432db1b..5f926de 100644

drivers/block/xen-blkfront.c static int blkif_queue_request(struct request *req) · line 495

Quoted 8 lines
drivers/block/xen-blkfront.c +1 -1
@@ -489,7 +489,7 @@ static int blkif_queue_request(struct request *req)
 
 			if ((ring_req->operation == BLKIF_OP_INDIRECT) &&
 			    (i % SEGS_PER_INDIRECT_FRAME == 0)) {
-				unsigned long pfn;
+				unsigned long uninitialized_var(pfn);
 
 				if (segments)
 					kunmap_atomic(segments);

I have a similar patch from Roger that sets pfn=0.

Roger could you repost your patch please or if you feel that this patch makes sense then comment on it?

Thanks.

#3 lore raw
Quoted 28 lines · Konrad Rzeszutek Wilk
Quoted 27 lines · Tim Gardner

pfn cannot actually be used unless (!info->feature_persistent), nor is pfn accessed in get_grant() unless (!info->feature_persistent), but silence this warning anyway. gcc-4.8

drivers/block/xen-blkfront.c: In function 'do_blkif_request':
drivers/block/xen-blkfront.c:508:20: warning: 'pfn' may be used uninitialized in this function [-Wmaybe-uninitialized] gnt_list_entry = get_grant(&gref_head, pfn, info); ^ drivers/block/xen-blkfront.c:492:19: note: 'pfn' was declared here unsigned long pfn;

Cc: Konrad Rzeszutek Wilk <[email protected]> Cc: Boris Ostrovsky <[email protected]> Cc: David Vrabel <[email protected]> Signed-off-by: Tim Gardner
<[email protected]> --- drivers/block/xen-blkfront.c | 2
+- 1 file changed, 1 insertion(+), 1 deletion(-)

(quoted diff) +0 -0

b/drivers/block/xen-blkfront.c index 432db1b..5f926de 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c

(quoted diff) +0 -0
@@ -489,7 +489,7 @@ static int blkif_queue_request(struct request
 *req)
 

if ((ring_req->operation == BLKIF_OP_INDIRECT) && (i %
SEGS_PER_INDIRECT_FRAME == 0)) { - unsigned long pfn; +
unsigned long uninitialized_var(pfn);

Quoted 9 lines
Quoted 1 line

if (segments) kunmap_atomic(segments);

I have a similar patch from Roger that sets pfn=0.

Roger could you repost your patch please or if you feel that this patch makes sense then comment on it?

Thanks.

The advantage of uninitialized_var() is that it doesn't actually generate any code (or so it says in the header).

rtg

Signature · 1 line
Tim Gardner [email protected]
#4 lore raw
In reply to Konrad Rzeszutek Wilk
Quoted 28 lines · Konrad Rzeszutek Wilk
Quoted 27 lines · Tim Gardner

pfn cannot actually be used unless (!info->feature_persistent), nor is pfn accessed in get_grant() unless (!info->feature_persistent), but silence this warning anyway. gcc-4.8

drivers/block/xen-blkfront.c: In function 'do_blkif_request':
drivers/block/xen-blkfront.c:508:20: warning: 'pfn' may be used uninitialized in this function [-Wmaybe-uninitialized] gnt_list_entry = get_grant(&gref_head, pfn, info); ^ drivers/block/xen-blkfront.c:492:19: note: 'pfn' was declared here unsigned long pfn;

Cc: Konrad Rzeszutek Wilk <[email protected]> Cc: Boris Ostrovsky <[email protected]> Cc: David Vrabel <[email protected]> Signed-off-by: Tim Gardner
<[email protected]> --- drivers/block/xen-blkfront.c | 2
+- 1 file changed, 1 insertion(+), 1 deletion(-)

(quoted diff) +0 -0

b/drivers/block/xen-blkfront.c index 432db1b..5f926de 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c

(quoted diff) +0 -0
@@ -489,7 +489,7 @@ static int blkif_queue_request(struct request
 *req)
 

if ((ring_req->operation == BLKIF_OP_INDIRECT) && (i %
SEGS_PER_INDIRECT_FRAME == 0)) { - unsigned long pfn; +
unsigned long uninitialized_var(pfn);

Quoted 9 lines
Quoted 1 line

if (segments) kunmap_atomic(segments);

I have a similar patch from Roger that sets pfn=0.

Roger could you repost your patch please or if you feel that this patch makes sense then comment on it?

Thanks.

The advantage of uninitialized_var() is that it doesn't actually generate any code (or so it says in the header).

rtg

Signature · 1 line
Tim Gardner [email protected]
#5 lore raw
In reply to Konrad Rzeszutek Wilk
Quoted 14 lines · Konrad Rzeszutek Wilk
Quoted 13 lines · Tim Gardner

pfn cannot actually be used unless (!info->feature_persistent), nor is pfn accessed in get_grant() unless (!info->feature_persistent), but silence
this warning anyway. gcc-4.8

drivers/block/xen-blkfront.c: In function 'do_blkif_request':
drivers/block/xen-blkfront.c:508:20: warning: 'pfn' may be used uninitialized in this function [-Wmaybe-uninitialized]

    gnt_list_entry = get_grant(&gref_head, pfn, info);
                   ^
drivers/block/xen-blkfront.c:492:19: note: 'pfn' was declared here
    unsigned long pfn;
Quoted 4 lines
Quoted 4 lines
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc David Vrabel <[email protected]>
Quoted 16 lines
Quoted 16 lines

---
drivers/block/xen-blkfront.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/xen-blkfront.c +1 -1
index 432db1b..5f926de 100644
@@ -489,7 +489,7 @@ static int blkif_queue_request(struct request *req)
 
 			if ((ring_req->operation == BLKIF_OP_INDIRECT) &&
 			    (i % SEGS_PER_INDIRECT_FRAME == 0)) {
-				unsigned long pfn;
+				unsigned long uninitialized_var(pfn);
 
Quoted 6 lines

drivers/block/xen-blkfront.c static int blkif_queue_request(struct request *req) · line 495

Quoted 2 lines
drivers/block/xen-blkfront.c +0 -0
 				if (segments)
 					kunmap_atomic(segments);

I have a similar patch from Roger that sets pfn=0.

Roger could you repost your patch please or if you feel that this patch makes sense then comment on it?

I'm fine with this patch, although I'm more used to the classic pfn = 0.

#6 lore raw
In reply to Konrad Rzeszutek Wilk
Quoted 14 lines · Konrad Rzeszutek Wilk
Quoted 13 lines · Tim Gardner

pfn cannot actually be used unless (!info->feature_persistent), nor is pfn accessed in get_grant() unless (!info->feature_persistent), but silence
this warning anyway. gcc-4.8

drivers/block/xen-blkfront.c: In function 'do_blkif_request':
drivers/block/xen-blkfront.c:508:20: warning: 'pfn' may be used uninitialized in this function [-Wmaybe-uninitialized]

    gnt_list_entry = get_grant(&gref_head, pfn, info);
                   ^
drivers/block/xen-blkfront.c:492:19: note: 'pfn' was declared here
    unsigned long pfn;
Quoted 4 lines
Quoted 4 lines
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc David Vrabel <[email protected]>
Quoted 16 lines
Quoted 16 lines

---
drivers/block/xen-blkfront.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/xen-blkfront.c +1 -1
index 432db1b..5f926de 100644
@@ -489,7 +489,7 @@ static int blkif_queue_request(struct request *req)
 
 			if ((ring_req->operation == BLKIF_OP_INDIRECT) &&
 			    (i % SEGS_PER_INDIRECT_FRAME == 0)) {
-				unsigned long pfn;
+				unsigned long uninitialized_var(pfn);
 
Quoted 6 lines

drivers/block/xen-blkfront.c static int blkif_queue_request(struct request *req) · line 495

Quoted 2 lines
drivers/block/xen-blkfront.c +0 -0
 				if (segments)
 					kunmap_atomic(segments);

I have a similar patch from Roger that sets pfn=0.

Roger could you repost your patch please or if you feel that this patch makes sense then comment on it?

I'm fine with this patch, although I'm more used to the classic pfn = 0.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel