From patchwork Fri Jan 1 14:21:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101216 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp3984294lbb; Fri, 1 Jan 2016 06:23:16 -0800 (PST) X-Received: by 10.67.7.101 with SMTP id db5mr107513158pad.53.1451658196600; Fri, 01 Jan 2016 06:23:16 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fm5si40946340pab.89.2016.01.01.06.23.16; Fri, 01 Jan 2016 06:23:16 -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; 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 S1751864AbcAAOW3 (ORCPT + 29 others); Fri, 1 Jan 2016 09:22:29 -0500 Received: from mout.kundenserver.de ([212.227.126.133]:56164 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750996AbcAAOW1 (ORCPT ); Fri, 1 Jan 2016 09:22:27 -0500 Received: from wuerfel.localnet ([134.3.118.24]) by mrelayeu.kundenserver.de (mreue001) with ESMTPSA (Nemesis) id 0MDHlU-1aTM4n1Qaa-00GXnE; Fri, 01 Jan 2016 15:21:57 +0100 From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Cc: Jan Kara , linux-kernel@vger.kernel.org Subject: [PATCH v2] udf: avoid uninitialized variable use Date: Fri, 01 Jan 2016 15:21:54 +0100 Message-ID: <5491623.oZlI0zcRmi@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <9221187.T0u8gszVyj@wuerfel> References: <9221187.T0u8gszVyj@wuerfel> MIME-Version: 1.0 X-Provags-ID: V03:K0:o74IWH5qCG3cZF/JMchvypPiSJ9RvxKlOg4CidYnKCgmba03ZeY QUEu/62lYw4trfwYWRmie/RItw+MFAPtxEypaNjHdbvbKwdt+0hmvztTBJ474cQpmuNmCIg a81MFGZVtk2yNfGG7eXVVxTJZTU3uR7s64y5oqkzEPRHsYLYGSf/ZTVnEMjPNY/ppaZMAXI Z9Bmvs/QkbiswRWqfqcTA== X-UI-Out-Filterresults: notjunk:1; V01:K0:JqIUu9Os9hQ=:utvrpv8Jw4Nz5w7+3MeI03 OHhI4q3qFttjTA9PqmXeeAuH2quY8yMQ4aUJJMsLURkj09PozWg8R5FIorosihLes0JWZqxzA vbbQj1+qJtTi89e7dbZpZiVKMYViqGAYoLmvoZTK3CDfkp7kETYNK4I3vKeqCKzydx4mwvR63 y9WEmQMt8uy/28tFqmxmEqlcuZ9fPCe0fPmXPCUieQWXKoM+ktgslMutfkbwKucdLEnbTuMZo fdfAMUbCpW+sTbonsw1ZAey2i5vPBXkNfYY3kgOhvJ39SBWVEzTlIfJO+41PrWETB73BxO6RJ nIvG9Wc/9qB82qbtC503WS3Fr3vnn4NmS1tCsFNsWpRwquxg+qet8lAPLO81a86Fg2jtmvohe MxGY7RmbAGd+kZCQAFlLlmzC1qWKhzaB+64cDOvAFx0ISYYAUrblD0wiE4TetfrcoJ2O8GGyk 4Aekz6JOLG3eYsnpsi4KZKkLdiOJOADH1EMWbHchrx+Wz/fpwIcp1Uxje3KcskyreZZuI6u0A k9gOZluzX9R3kc7ZPUOvK/kdarM7OD440vVYpyzK2RGuMAe0JjZBbVzL40OEMLyHLhsJhtfU0 VELKcYNnrSg5sHtZsj48vCQHcRG4xXBqre+CpC9nToVTU7JbjzJeULq2DJqLMsTa66SttGwak oqq3iijv/T3S+U7X/oY2cwxuXgQzLFRKWLTk4bDGLt/YOFcILtKMTN5DG5BzGg+X5uAYhGN4T w7TGHvfq1HQyvOFg Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ Signed-off-by: Arnd Bergmann Signed-off-by: Jan Kara diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 5b83351041a4..42f68dd7e6ef 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c @@ -1890,6 +1890,8 @@ int udf_setup_indirect_aext(struct inode *inode, int block, adsize = sizeof(struct short_ad); else if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_LONG) adsize = sizeof(struct long_ad); + else + adsize = 0; neloc.logicalBlockNum = block; neloc.partitionReferenceNum = epos->block.partitionReferenceNum; @@ -1963,6 +1965,8 @@ int __udf_add_aext(struct inode *inode, struct extent_position *epos, adsize = sizeof(struct short_ad); else if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) adsize = sizeof(struct long_ad); + else + adsize = 0; if (!epos->bh) { WARN_ON(iinfo->i_lenAlloc !=