Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp742016img; Fri, 22 Mar 2019 07:39:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqxe/HAlQMmzR//+x/HyCrCnwSYlDWVKxjzY/1nAFQ/7cCfkSn1GcuxCNcuO+/yaCN4hN42W X-Received: by 2002:a17:902:b716:: with SMTP id d22mr10151162pls.9.1553265552747; Fri, 22 Mar 2019 07:39:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553265552; cv=none; d=google.com; s=arc-20160816; b=GzLJYYeftGB/4eUBhtDxdk4aXrSXuMwF1snzKFqrAL2YNCye3Ivhyi/iDhgy6qJ/EL 7yHrE2yFHNsuCe2KTjUAs43YYfr86DR7g/1jFpE69mHnlV2zzycIQSlieeRpz5pLK8tR B4TfXQIy7YGfB1t78uS73KNBHt1N256mFd2rEXWCcB6/MTgyT+sNOaF7thkjZf+UH9kf s1TC+38tCthFB7v+aNZGcR12Dq4Ol1I7u26vQNnkOYiuS8ben/jWBFKuODGepPRNZXGh mCT0kQWQwD98sVYP+64e7krqkJGluPjL6fZ3a1Bf3FCf1OM/fOS3exsY8QWJD1qxszko 6pzw== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=wiRhwfVawHglwe+JOO64n2Ou3xWXdJFj4D6tMiCProY=; b=v5E03s/ftbFqdOEhTMiVtJPV1vImY1hkhfvzsjuBC0yZan3DsrhJ/w9bj79BkJWweU K3r9nzOEfJtqJzS1ppywiEheDOsFUSbt8+GzdiVx7m1Eg5q19tJv+axyBv9tbb4Ai+MK 3wl6j0K7Fa+pQK+nOu2pG38r2NSUF/Hdagfy//QjLRmxOLK7gjD9PL1J1Mr94eQZUwi6 6mmwDZ9QQDSCWG/tSBVnD7k2/em/jMNybIhfNsnKtE9Z/sREa/sAhrgGsVM3+TJQFIJW BEy6pKeyOPub1gZAx8MN8VAp+HYPYLkR2Ua+cn9+VscD65eqQPM9EtlTjMADuwQ9d644 OAWQ== 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 16si1842355pfr.26.2019.03.22.07.38.57; Fri, 22 Mar 2019 07:39:12 -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 S1729241AbfCVOgd convert rfc822-to-8bit (ORCPT + 99 others); Fri, 22 Mar 2019 10:36:33 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:39560 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729211AbfCVOgb (ORCPT ); Fri, 22 Mar 2019 10:36:31 -0400 Received: by mail-qk1-f195.google.com with SMTP id c189so1327717qke.6; Fri, 22 Mar 2019 07:36:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=/HL8Tg1lWXyP/ZQj2pyLGJ+TOXyu3xswQLjsHsrEWes=; b=tGsAFO3H/Mk6vozZ1kiqAkSg6Oo/xZToRu2/aYnFC/FCY9SCbM58FLoDEFmIJSJ4kU JMvS4rZJMnGu9qS3/EppQcj72IG8hovyt3bABKm3sy4vjfPy2K7Fkg9yWG13AKPO1D8h VHHO+TiTtBZrU28/85bmPYU8+5fSmCkmBx4TTp188zHdUWActwCf3QO90DHPUQXiK5S0 Oqv4rUAX7MJTJJhIbkeFxriF9B2S8PGHIJcQHs9XmYOVbtGUa/VN8YP9Bc9ZAeAupGPY Hnx/uJqbCHAJTcEflfajo/ux6+O0ZHGizKZCsPuXujAEbYveuQ1wJr7c4aQGQjT1ssge Wfjg== X-Gm-Message-State: APjAAAUUhTMqRCSyVZ5Yk52tBeEBXS6euMCMl649wetsfZxXZw+MS8IH 8LdCcwC4/AN6ESXR5BKpPIb3P33SjVZ331Exk5DtidUL X-Received: by 2002:a05:620a:133b:: with SMTP id p27mr7772328qkj.173.1553265390390; Fri, 22 Mar 2019 07:36:30 -0700 (PDT) MIME-Version: 1.0 References: <20190307221054.13126-1-natechancellor@gmail.com> <94c7f399-7101-2297-43e0-834f50c3510f@suse.de> In-Reply-To: <94c7f399-7101-2297-43e0-834f50c3510f@suse.de> From: Arnd Bergmann Date: Fri, 22 Mar 2019 15:36:12 +0100 Message-ID: Subject: Re: [PATCH] bcache: Zero initialize bucket in bch_allocator_thread To: Coly Li Cc: Nathan Chancellor , Kent Overstreet , linux-bcache@vger.kernel.org, Linux Kernel Mailing List , clang-built-linux@googlegroups.com, Nick Desaulniers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 8, 2019 at 3:11 AM Coly Li wrote: > On 2019/3/8 6:10 上午, Nathan Chancellor wrote: > > When building with -Wsometimes-uninitialized, Clang warns: > > > > drivers/md/bcache/alloc.c:333:4: warning: variable 'bucket' is used > > uninitialized whenever 'if' condition is false > > [-Wsometimes-uninitialized] > > > > fifo_pop expands to a conditional depending on '!fifo_empty(...)', which > > is the same condition as the while loop. It seems Clang can't piece > > together that this condition will never been false as long as we are in > > the while loop because they are the same condition. It's easy enough to > > silence this warning by just explicitly zero initializing bucket. > > > > Link: https://github.com/ClangBuiltLinux/linux/issues/396 > > Signed-off-by: Nathan Chancellor > > Hi Nathan, > > Nice catch, I will add it to my for-test. Thanks. I saw the same warning but came up with a nicer (IMHO) fix, see https://lore.kernel.org/lkml/20190322143507.1256436-1-arnd@arndb.de/T/#u Arnd