From patchwork Sat Mar 3 22:25:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 130589 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp1164704lja; Sat, 3 Mar 2018 16:30:44 -0800 (PST) X-Google-Smtp-Source: AG47ELtHEnLUFzzEeiyyQsEbQSBfsnC6vTROehoKwsrKIfZol7xsUvfevNf0fZxV+Dc4RVfsTdKd X-Received: by 10.99.56.83 with SMTP id h19mr8251369pgn.230.1520123444375; Sat, 03 Mar 2018 16:30:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520123444; cv=none; d=google.com; s=arc-20160816; b=LuAxS+A70QluCoVc64NSMxgmaO++2HBNdbvyT5OsHe4rRqOh54CTuDnckVZl7QKjXU qy+2AJq5977EehcYB5M/G2ApKxkm7P2IhxHCePXWA4TZrBzcRGQdb5NJY2PPwu+n+K3M sfUgh8LQ4yZAPiCdqX5pquhDFTLhI6mKdzxRPxRIxpMga0ljmXlORBLHdQ9NIz4QF1Bq I7myrAcDGxk2HE4ms1+QevzUsBLu+wifgVC4bnjU5lqz/vzov1Os7J2XpZ9jq9S/P+Tu AkOHzy6LSrXbg7Sjpehh9mKaTjCSyLn8WlT3trgG0DxCERUJOccE0CbXXx9heXxsNViG 5ZLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=7uEefgeuwkVTbWNtTD8/gGuphBpvnQqAVk7XO1+SWGc=; b=pDU9/YF3Y6Pbroj5k6aDe5fluqvw4RAnXt7IYjRoGhqEcI/zCMB7GCN09/qaR/yZBH NhVUq4ruVzbrX519GPNA6/7tLYaTVLGaY9hqip7sGdGKRwYGjOux9ZcoqCr+XWwcbS/3 9neTgwEuDNgMimJNP+9DDqwwSm0yIpGNqYR+XoDd4pc0dpnzHa2i7f6OrFwypEOKDYIC EZUfc5I6vkwzg02dgqbhMBeIhpTH5L0WAZv8fVFeNNz2yydlyVj0NUO27jYrfmIe6uWm liWfMabDfUylrQfz3sVk3EcXplokqu0u+h6ioEMDfbsyihI5eYGALNVxwdIqle49kt9o 9enQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Wy0lP3XC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j1-v6si7077706pld.734.2018.03.03.16.30.44; Sat, 03 Mar 2018 16:30:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Wy0lP3XC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933588AbeCDAa0 (ORCPT + 28 others); Sat, 3 Mar 2018 19:30:26 -0500 Received: from mail-by2nam01on0124.outbound.protection.outlook.com ([104.47.34.124]:45281 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932401AbeCCW2D (ORCPT ); Sat, 3 Mar 2018 17:28:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=7uEefgeuwkVTbWNtTD8/gGuphBpvnQqAVk7XO1+SWGc=; b=Wy0lP3XCcXLPQYeZVwfxwy6zxm0GYMrQiGKzC8/cICu+vLuVmIGvpO7ZP4PLd0ZZ3ohoN3oDHTfwDOEQaHH7OJZtLOXM+3MBNLX9Q0Ktu/cCem00zNAzQaOkGtg9SHNMOX9jJMjDwBtR9/39fhnS/TiyafVf520Yc3rtMoYqFUo= Received: from MW2PR2101MB1034.namprd21.prod.outlook.com (52.132.149.10) by MW2SPR01MB06.namprd21.prod.outlook.com (52.132.152.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.567.3; Sat, 3 Mar 2018 22:27:55 +0000 Received: from MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0]) by MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0%3]) with mapi id 15.20.0567.006; Sat, 3 Mar 2018 22:27:55 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Arnd Bergmann , Jason Gunthorpe , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 101/102] IB/mlx5: revisit -Wmaybe-uninitialized warning Thread-Topic: [PATCH AUTOSEL for 4.15 101/102] IB/mlx5: revisit -Wmaybe-uninitialized warning Thread-Index: AQHTsz58yx7HL5fbRk6C7X4SqVSK6g== Date: Sat, 3 Mar 2018 22:25:08 +0000 Message-ID: <20180303222318.26006-101-alexander.levin@microsoft.com> References: <20180303222318.26006-1-alexander.levin@microsoft.com> In-Reply-To: <20180303222318.26006-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MW2SPR01MB06; 7:FwMXJLQMhoV9lOzNrWolqCJLsLhmfV/NQ3wdsxSbSYIxah2n09NjGSFoh0IDBqn/VdBNDnOhaGrDwi0qVnpvaQvPi/yQfS9FowSZgaWwpb8jD6C/kAGtb3AAJkmdc9v4+qr4/shEnbAvBUK7LvFz6h/HGD0eWa8hPXlDquowg7X+DpH6OQ641n2lQ5BXL5UkBerxt31oGbPLlGQYW29cSmmMueI/Zt7agarCLTuH2DFKcJfPdcB1fdbs9yXIvY40 x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: d1282c2a-d638-403c-458e-08d58156027c x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(3008032)(2017052603307)(7193020); SRVR:MW2SPR01MB06; x-ms-traffictypediagnostic: MW2SPR01MB06: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040501)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231220)(944501244)(52105095)(6055026)(61426038)(61427038)(6041288)(20161123562045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011); SRVR:MW2SPR01MB06; BCL:0; PCL:0; RULEID:; SRVR:MW2SPR01MB06; x-forefront-prvs: 0600F93FE1 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(366004)(39380400002)(396003)(346002)(39860400002)(189003)(199004)(68736007)(2900100001)(97736004)(107886003)(36756003)(1076002)(76176011)(86612001)(6666003)(6116002)(99286004)(22452003)(10090500001)(3280700002)(105586002)(2950100002)(3846002)(26005)(2501003)(6506007)(4326008)(305945005)(25786009)(7736002)(66066001)(54906003)(86362001)(575784001)(8936002)(72206003)(3660700001)(6512007)(110136005)(14454004)(5660300001)(5250100002)(478600001)(102836004)(106356001)(8676002)(81166006)(6486002)(186003)(316002)(10290500003)(53936002)(6436002)(59450400001)(2906002)(81156014)(22906009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:MW2SPR01MB06; H:MW2PR2101MB1034.namprd21.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: BeobVXZZqtkI8nZQzvtOz90ejzyoDHy8rBU14Q8snX1bIg6rnGEP5NFTke0L0vFvcOPGpZcnUuVH3BQsdVJYe/v+FTZyGOlaDvXgK+dfVI1GKm2k/qLMUd6ibTnK+GN6VTFqVUCmoxZctVFyt51zU8WWt2AM7eEErAhT9CVrIhU= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: d1282c2a-d638-403c-458e-08d58156027c X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Mar 2018 22:25:08.1659 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2SPR01MB06 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann [ Upstream commit 1b19b95169cd52fe82cd442fec0b279fe25cc838 ] A warning that I thought I had fixed before occasionally comes back in rare randconfig builds (I found 7 instances in the last 100000 builds, originally it was much more frequent): drivers/infiniband/hw/mlx5/mr.c: In function 'mlx5_ib_reg_user_mr': drivers/infiniband/hw/mlx5/mr.c:1229:5: error: 'order' may be used uninitialized in this function [-Werror=maybe-uninitialized] if (order <= mr_cache_max_order(dev)) { ^ drivers/infiniband/hw/mlx5/mr.c:1247:8: error: 'ncont' may be used uninitialized in this function [-Werror=maybe-uninitialized] drivers/infiniband/hw/mlx5/mr.c:1247:8: error: 'page_shift' may be used uninitialized in this function [-Werror=maybe-uninitialized] drivers/infiniband/hw/mlx5/mr.c:1260:2: error: 'npages' may be used uninitialized in this function [-Werror=maybe-uninitialized] I've looked at all those findings again and noticed that they are all with CONFIG_INFINIBAND_USER_MEM=n, which means ib_umem_get() returns an error unconditionally and we never initialize or use those variables. This triggers a condition in gcc iff mr_umem_get() is partially but not entirely inlined, which in turn depends on the exact combination of optimization settings. This is a known problem with gcc, with no easy solution in the compiler, so this adds another workaround that should be more reliable than my previous attempt. Returning an error from mlx5_ib_reg_user_mr() earlier means that we can completely bypass the logic that caused the warning, the compiler can now see that the variable is never accessed. Fixes: 14ab8896f5d9 ("IB/mlx5: avoid bogus -Wmaybe-uninitialized warning") Signed-off-by: Arnd Bergmann Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/hw/mlx5/mr.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.14.1 diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c index d109fe8290a7..556e015678de 100644 --- a/drivers/infiniband/hw/mlx5/mr.c +++ b/drivers/infiniband/hw/mlx5/mr.c @@ -1206,6 +1206,9 @@ struct ib_mr *mlx5_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, int err; bool use_umr = true; + if (!IS_ENABLED(CONFIG_INFINIBAND_USER_MEM)) + return ERR_PTR(-EINVAL); + mlx5_ib_dbg(dev, "start 0x%llx, virt_addr 0x%llx, length 0x%llx, access_flags 0x%x\n", start, virt_addr, length, access_flags);