From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752333AbcBKOGn (ORCPT ); Thu, 11 Feb 2016 09:06:43 -0500 Received: from imap.thunk.org ([74.207.234.97]:40012 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750889AbcBKOGj (ORCPT ); Thu, 11 Feb 2016 09:06:39 -0500 Date: Thu, 11 Feb 2016 09:06:37 -0500 From: "Theodore Ts'o" To: Jeff Merkey Cc: LKML Subject: Re: [BUG REPORT] use of unreachable() masks uninitialized variables warnings Message-ID: <20160211140637.GN26922@thunk.org> Mail-Followup-To: Theodore Ts'o , Jeff Merkey , LKML References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on imap.thunk.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 10, 2016 at 08:13:09PM -0700, Jeff Merkey wrote: > Here are the sources of several bugs I have seen recently in ext4 I am > pretty sure with a null bh. One good check is to set the BUG() macro > NOT TO call unreachable() as a build test since the compiler will > ignore uninitialized variables in a function if someone calls BUG() > even conditionally, and never report them during build. > > The following are from v4.4.1 with a BUG() macro with the call to > unreachable() removed: I checked all of the fs/ext4 warnings you listed and they are all false positives. > In file included from fs/ext4/file.c:30:0: > fs/ext4/ext4_jbd2.h: In function ‘ext4_inode_journal_mode’: > fs/ext4/ext4_jbd2.h:409:1: warning: control reaches end of non-void > function [-Wreturn-type] > } This is from a: if (foo) { ... return foobie; } else if (bar) { ... return barbie; } else { BUG(); } construct. > fs/ext4/inode.c: In function ‘ext4_map_blocks’: > fs/ext4/inode.c:548:5: warning: ‘retval’ may be used uninitialized in > this function [-Wmaybe-uninitialized] > if (retval > 0 && map->m_flags & EXT4_MAP_MAPPED) { > ^ > fs/ext4/extents.c:2305:14: warning: ‘len’ may be used uninitialized in > this function [-Wmaybe-uninitialized] > ext4_lblk_t len; > ^ All of the may be used uninitialized warnings are from a: if (foo) { ... retval = xxx; } else if (bar) { ... retval = yyy; } else { BUG(); } construct. It may be that there are some false warnings, but they certainly weren't from warnings you've listed from ext4. Cheers, - Ted