From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753109AbcADKrC (ORCPT ); Mon, 4 Jan 2016 05:47:02 -0500 Received: from mout.kundenserver.de ([212.227.126.134]:49825 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751308AbcADKrB (ORCPT ); Mon, 4 Jan 2016 05:47:01 -0500 From: Arnd Bergmann To: Jan Kara Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] udf: avoid uninitialized variable use Date: Mon, 04 Jan 2016 11:46:28 +0100 Message-ID: <3635579.F68L9XXk6v@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <20160104095605.GC3888@quack.suse.cz> References: <9221187.T0u8gszVyj@wuerfel> <5491623.oZlI0zcRmi@wuerfel> <20160104095605.GC3888@quack.suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:DcjrAGIsN6RpUS8qpG4eRnZKBxmeNuVd26d8Wf0uuKHfh8BUmVz 8zhlp83D3/o0/JqtlW05RqdH7OS4KC2+XkgvzLBsubn5E2MYB2RLlQmTMLupJHdYyiLo98i Nz6XlGnQABzgVqLdRlMz4Asa9QVhkUXqmhfddDUIOqtuOPabAaRtkeTRWAXrNRjuz5sUOKV M/Dc19U1uxTMOfgOMF/2g== X-UI-Out-Filterresults: notjunk:1;V01:K0:5sIy3mXDVBg=:RVfVlh4rCyAF9nVKG0YmsB 95PtP4AfRfmB7Q8J9dRsmCWT0lxMzMI3sw3C+/GvOsSCF0y/83g++cja8YhADoakNWd211wfg QMlKirPUFNFbJbRmZMRWUj4tsjLCx4BJnBrhWgAV8P1Jv8rw/2PqQ5t7xwuwYtTqacVD+vwDt ZQr0tGfbmUdDyRKFuyQ5k6zjFbDCkeKcceLaTSmHp/bA7vo5BLdoDM2pirhz4opIyEbDe6ESp 6GXaCgep9uHJpAWqinX4Ct2imEUxtt/abJnwnMoZp6slZ1BQCVgyPJMW64N2JefHAp7PNWNKb aNj1ZqMs6BBYLodk8IebEmJK8+6kjrikCUmTiP7bYLSozAXniKQBlmyZ5g0XRv33C15mprNRg CxpFQQZrdXiA3WzxW5JTgbycXv1AVcxlAljBFVG64orTWtwoqu+izLhLfP0fc+NMUUBl4hLML /evhBCNwEn/d/UZ7vWPTAT0viCxz9B3j6gm2JpOAWD9KEIxNqmSKrR4rr2VSVqJDbfWV7WGWU afD97r2NOTx1X+piMl2BVbk8fFH8lOTnqC1bnWh++2axoFbtL3oI42XeZLiKObv/fW1jU5x0Q nd6TiRp1sEV/XSJfeETCTqOx9EMBOUYDsG7KfMkUvl/NsfvieDrckbKUdz1BL7RY1cCSfNu7+ JuYz5iD6M4ncdpv3jR3JJuNvTJngQy1NoaHQYZaL1OsCd4Jglte83Gj4sQYcWEigsE/yN0mZI yGjzg8m4Qm34GdU+ Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Monday 04 January 2016 10:56:05 Jan Kara wrote: > On Fri 01-01-16 15:21:54, Arnd Bergmann wrote: > > A new warning about a real bug has come up from a recent cleanup: > > > > fs/udf/inode.c: In function 'udf_setup_indirect_aext': > > fs/udf/inode.c:1927:28: warning: 'adsize' may be used uninitialized in this function [-Wmaybe-uninitialized] > > > > If the alloc_type is neither ICBTAG_FLAG_AD_SHORT nor ICBTAG_FLAG_AD_LONG, > > the value of adsize is undefined. This changes the code to use zero for adsize > > in that case, which may be the correct solution, though I have not looked > > at the code in enough detail to know if it should be something else instead. > > > > Signed-off-by: Arnd Bergmann > > Fixes: fcea62babc81 ("udf: Factor out code for creating indirect extent") > > --- > > sorry for missing another instance the first time around. The warning is > > a bit unreliable and it seems in my first configuration I got it only > > for one of the two instances that show it in other configuration. > > > > After checking the remaining functions in this file for the same possible > > problem, I found that the other functions use either 'BUG()' or 'return -EIO' > > in the 'else' path, so I assume the two functions here should one of those > > as well, but I don't know which. > > Callers of these functions make sure alloc_type is one of the two valid > ones. However for future-proofing you're right that probably we should > handle the invalid case as well. Setting adsize to zero is problematic - > not sure what the code would actually do but it wouldn't definitely work. > I'd just return -EIO. Attached is the patch I have merged. > > Looks good, thanks! Arnd