From patchwork Fri Mar 22 14:07:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160898 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp858140jan; Fri, 22 Mar 2019 07:08:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqz8NCTyn/9F7+xgTaH6ZSV3GqLkFilH27AaJ39oygI3ydi9egqfy/CebHqLoB8nzyKxd2T8 X-Received: by 2002:a17:902:bd02:: with SMTP id p2mr9712979pls.260.1553263726176; Fri, 22 Mar 2019 07:08:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553263726; cv=none; d=google.com; s=arc-20160816; b=vYFObDQwzVC6sRs/IV/wpI2e9+v6DcWWGghYzIjhEJw0mzJfXUwnHlwYyxvski6LUn 0T05AwmPR32cb9CWq0aB2otlXJvcK7nds0uf1A/eREZyaISJu103cS97sJqXYbao2SRr jCpBVf5NTddjUAnH5yJUAupGWDFjx+tnkaF+iQiWdrfPhvJgyx8ogiejDM/htm6RZSbK d4vK+xlNqbcZlcpcivoBkUCnZAu8k7xpoKxuK5BYcsgjrlB6lMspVPPcVaNCuFr/aATt S0F9p/k/WlikEvpy+BLB5rhyaNB5FQr2MCBw58XzOglq0WeFyelSSuPXmVYfOprIVvfK KH6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=cN8HQ1Cv7scVevDj8I00z/7FF8oFoobW7KM8xYSa5+Y=; b=wL81efMGgq2RZHRYbfNhM93jrnOYaiKg0Lp71YbTcZatZKSEHdIgh14L/WZyJruGw1 PZL2LbzRxN7RLAZnseVC2NuCOmcBbb5wHSXZ7cquVBNS3BYJJlwvj/NbtcArY+YQV0m+ KLaxBKAUna8iQiO4rsS/abXH3OP2kHPSpxsKrFfcMgHXh59Aq/nj+64zG5pLjHrQil1o C1GmRy/45euLMuEvrPB2pGveQF4ves4SjNuCqUtYQwL7IR2FGBDxLlJGrtFhjUwgz7/k K/TsHflqpIvF/M6GhNZfiAqLUuP402bP4q/Dmx5NCHPCQJwYm/7/SPIOxHCEoXhJE/Ca GSPw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b7si7443327pla.195.2019.03.22.07.08.45; Fri, 22 Mar 2019 07:08:46 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728182AbfCVOIo (ORCPT + 31 others); Fri, 22 Mar 2019 10:08:44 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:49477 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727487AbfCVOIn (ORCPT ); Fri, 22 Mar 2019 10:08:43 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPA (Nemesis) id 1MC2o9-1hHSly04XV-00CPFR; Fri, 22 Mar 2019 15:07:55 +0100 From: Arnd Bergmann To: Chris Mason , Josef Bacik , David Sterba Cc: clang-built-linux@googlegroups.com, Nick Desaulniers , Nathan Chancellor , Arnd Bergmann , Nikolay Borisov , Lu Fengqi , Anand Jain , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] btrfs: work around false-positive -Wsometimes-uninitialized warning Date: Fri, 22 Mar 2019 15:07:47 +0100 Message-Id: <20190322140753.286171-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:CSYo6DUUj4yfxJ2QTSL1M70TqeZn/gI2tHJcjNE7Bi4lNZg1sPl oc0yZzTWg8ego/C1EoZfkAFaWGqm5IhLsSCFcHk57Hsl8Kfw0bFwosz1sCFl998qSLWUTC2 /rtQd4qujE2vdeZXSdE40Rt3GS5uSE6nhY9TwBKsLnZsXXZv+ZBNJ0i88IhULXr37zaL0Dh 7Wnt333AzMDK/6xV/iQYg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:5WWCgDRAZuM=:dSc3pDc6/RclNdtuOPPtqH jLO0ArEpOVUpdEdKPUr6Iv45fPwhtkZ9bCb+Yop3y7leu4D1Vw/MaO+NiPHQaPINty0F3W6ts Hl3WcGVH4QQxDZ97xvrQMLe2HpblHBsx95Rn+YXTAdTfBVY8zrY1jGXxUSh7vTpAmO0XzFWxW LdLnLHJtBJdmMCnGqqdXhz1eAk+BFYmvZEZYhYTqra9QaugVjwO76dhEFENlSXWM3cMBxaAqE +/+aVlRxq+AFCkTGZd38HmU3zRq/5GUlmmnhCGsU8E3u660VefDIjaRDvJAETT2/Qxd5Tl5Lv 8WQT5fPHZrZ6tc7Xx0NqhDsDC7sn6EWl/DxgckxXctCwOZ1szffDLhz0XuXpdmqDLEXkKBVY3 EN9kpCvLKQGBPxJx1Six9IOyUdgOr8pYfIH9ZFvS9oJlA0kyAomtnFm4lLsSGfeWVOv7pZTrL Jn5llM4L3iQZvHN5g2a1ufN0xRC18A1CnIvm/im5qU7VvUJZ49pvVXH4jrG+D+lKAUSnzidd9 cwyTEvQpnewkCC0Ay7u8CT8MAEPlteJKkuRBDceN17HvHKhKvi2+y/ThsU568R3oGbIJcJC7N YEejDu+dJdlLUGLfsGzxfcZ+sy+dYdvuGLnAaFhHEcACj8ghxAGkSJVkwEwoEpT5F2wfkKfvc ObherSYh7YCqVaJ5eXLHyuvyBKY3YFhmwgCuFqbQpVajUlEribRMFFUblmOJFbQM10JHhSvJV lerV3FkjiGcb/KgK6kngzDWc3VkKKJa1toMKew== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org clang fails to see that the last 'else if() in btrfs_uuid_tree_add() is always true, so 'eb' is always initialized correctly: fs/btrfs/uuid-tree.c:129:13: error: variable 'eb' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] } else if (ret < 0) { ^~~~~~~ fs/btrfs/uuid-tree.c:139:22: note: uninitialized use occurs here write_extent_buffer(eb, &subid_le, offset, sizeof(subid_le)); ^~ fs/btrfs/uuid-tree.c:129:9: note: remove the 'if' if its condition is always true } else if (ret < 0) { ^~~~~~~~~~~~~ fs/btrfs/uuid-tree.c:90:26: note: initialize the variable 'eb' to silence this warning struct extent_buffer *eb; ^ = NULL Change it into a plain 'else' to shut up that warning. Link: https://bugs.llvm.org/show_bug.cgi?id=41197 Signed-off-by: Arnd Bergmann --- fs/btrfs/uuid-tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.0 diff --git a/fs/btrfs/uuid-tree.c b/fs/btrfs/uuid-tree.c index 3b2ae342e649..c1cc9a5c0024 100644 --- a/fs/btrfs/uuid-tree.c +++ b/fs/btrfs/uuid-tree.c @@ -126,7 +126,7 @@ int btrfs_uuid_tree_add(struct btrfs_trans_handle *trans, u8 *uuid, u8 type, slot = path->slots[0]; offset = btrfs_item_ptr_offset(eb, slot); offset += btrfs_item_size_nr(eb, slot) - sizeof(subid_le); - } else if (ret < 0) { + } else { btrfs_warn(fs_info, "insert uuid item failed %d (0x%016llx, 0x%016llx) type %u!", ret, (unsigned long long)key.objectid,