From patchwork Mon Jun 17 10:12:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Bolle X-Patchwork-Id: 2732481 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 47731C0AB1 for ; Mon, 17 Jun 2013 10:18:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9230F202BA for ; Mon, 17 Jun 2013 10:18:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AB162202B7 for ; Mon, 17 Jun 2013 10:17:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932530Ab3FQKR4 (ORCPT ); Mon, 17 Jun 2013 06:17:56 -0400 Received: from cpsmtpb-ews09.kpnxchange.com ([213.75.39.14]:61120 "EHLO cpsmtpb-ews09.kpnxchange.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932313Ab3FQKRy (ORCPT ); Mon, 17 Jun 2013 06:17:54 -0400 X-Greylist: delayed 309 seconds by postgrey-1.27 at vger.kernel.org; Mon, 17 Jun 2013 06:17:54 EDT Received: from cpsps-ews28.kpnxchange.com ([10.94.84.194]) by cpsmtpb-ews09.kpnxchange.com with Microsoft SMTPSVC(7.5.7601.17514); Mon, 17 Jun 2013 12:12:44 +0200 Received: from CPSMTPM-TLF102.kpnxchange.com ([195.121.3.5]) by cpsps-ews28.kpnxchange.com with Microsoft SMTPSVC(7.5.7601.17514); Mon, 17 Jun 2013 12:12:43 +0200 Received: from [192.168.1.102] ([212.123.139.93]) by CPSMTPM-TLF102.kpnxchange.com with Microsoft SMTPSVC(7.5.7601.17514); Mon, 17 Jun 2013 12:12:43 +0200 Message-ID: <1371463963.26299.9.camel@x61.thuisdomein> Subject: [PATCH] rbd: silence GCC warnings From: Paul Bolle To: Yehuda Sadeh , Sage Weil , Alex Elder Cc: ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 17 Jun 2013 12:12:43 +0200 X-Mailer: Evolution 3.6.4 (3.6.4-3.fc18) Mime-Version: 1.0 X-OriginalArrivalTime: 17 Jun 2013 10:12:43.0664 (UTC) FILETIME=[35023100:01CE6B43] X-RcptDomain: vger.kernel.org Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Building rbd.o triggers two GCC warnings: drivers/block/rbd.c: In function ‘rbd_img_request_fill’: drivers/block/rbd.c:1272:22: warning: ‘bio_list’ may be used uninitialized in this function [-Wmaybe-uninitialized] drivers/block/rbd.c:2170:14: note: ‘bio_list’ was declared here drivers/block/rbd.c:2231:10: warning: ‘pages’ may be used uninitialized in this function [-Wmaybe-uninitialized] Apparently GCC has trouble determining that "bio_list" is unused if "type" is "OBJ_REQUEST_PAGES" and, conversely, that "pages" will be unused if "type" is "OBJ_REQUEST_BIO". Add harmless initializations to NULL to help GCC. Signed-off-by: Paul Bolle --- 0) Compile tested only. 1) These warnings were introduced in v3.10-rc1, apparently through commit f1a4739f33 ("rbd: support page array image requests"). 2) Note that rbd_assert(type == OBJ_REQUEST_PAGES); seems redundant. I see no way that this assertion could ever be false. drivers/block/rbd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 3063452..b8a58178 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -2185,9 +2185,11 @@ static int rbd_img_request_fill(struct rbd_img_request *img_request, if (type == OBJ_REQUEST_BIO) { bio_list = data_desc; rbd_assert(img_offset == bio_list->bi_sector << SECTOR_SHIFT); + pages = NULL; } else { rbd_assert(type == OBJ_REQUEST_PAGES); pages = data_desc; + bio_list = NULL; } while (resid) {