Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[PATCH 3.13-rc1] xen-blkfront: Silence pfn maybe-uninitialized warning

0 views
Skip to first unread message

Tim Gardner

unread,
Nov 14, 2013, 4:40:02 PM11/14/13
to
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 <konra...@oracle.com>
Cc: Boris Ostrovsky <boris.o...@oracle.com>
Cc: David Vrabel <david....@citrix.com>
Signed-off-by: Tim Gardner <tim.g...@canonical.com>
---
drivers/block/xen-blkfront.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 432db1b..5f926de 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -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);
--
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Konrad Rzeszutek Wilk

unread,
Nov 14, 2013, 5:30:02 PM11/14/13
to
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.

Tim Gardner

unread,
Nov 14, 2013, 6:00:02 PM11/14/13
to
The advantage of uninitialized_var() is that it doesn't actually
generate any code (or so it says in the header).

rtg
--
Tim Gardner tim.g...@canonical.com

Roger Pau Monné

unread,
Nov 15, 2013, 7:10:02 AM11/15/13
to
On 14/11/13 23:24, Konrad Rzeszutek Wilk wrote:
> Tim Gardner <tim.g...@canonical.com> wrote:
>> 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 <konra...@oracle.com>
>> Cc: Boris Ostrovsky <boris.o...@oracle.com>
>> Cc: David Vrabel <david....@citrix.com>
>> Signed-off-by: Tim Gardner <tim.g...@canonical.com>

Acked-by: Roger Pau Monné <roge...@citrix.com>

>> ---
>> drivers/block/xen-blkfront.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/block/xen-blkfront.c
>> b/drivers/block/xen-blkfront.c
>> index 432db1b..5f926de 100644
>> --- a/drivers/block/xen-blkfront.c
>> +++ b/drivers/block/xen-blkfront.c
>> @@ -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?

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