Received: by 10.223.185.116 with SMTP id b49csp1039068wrg; Fri, 23 Feb 2018 10:48:26 -0800 (PST) X-Google-Smtp-Source: AH8x227EA7c/MkX5oM71Fpv6qbiSIXkTFnbwJ+Ox3LvWfvGgAPhPW61wdvNG7eBZs7voldg4ZHBe X-Received: by 10.99.149.2 with SMTP id p2mr2172218pgd.122.1519411706176; Fri, 23 Feb 2018 10:48:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519411706; cv=none; d=google.com; s=arc-20160816; b=mFiG3YTGCXGfCm6sVlX/prsYWj4rpYUazAztlBlqeRL6WXsEy0NU+KjvEr3YMjkHvo Z6YqKvmszrltYJO48vTv1o36KyGUyr/NpkRbqYOJhzJsoTk83Q/z55FiRgWCQCLNc7K3 KIYQaNC9p+5T6rrsBaYC9BCEklM3x760oJEuBxOovgejPXM6xJqkPURNtALnKawWlniJ OaXz0Dwi2AW1y6hNZ/Ai2Av0yGP0iemC8LR7glvQlL0lr4U1RFIsb6Ichsf21t53hj8M DEWg5+cB/Hoc6W67ZPhjTgZk4FuHXjJlCqvjIM37ZHiHAkfsNfxE6ZiZbQBzzVGvxowA B1GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=/Jd3/658BfDh8HCesVVdu4e7NqzCFKPCjDW8xIf9qnc=; b=SlW0cTg7/LzhF5wbRwCaMI3/H7fTqg95nk91puWBcx7tvN2WYC5xKuubgKN2JLTIR8 miDJQUaeJGJ0ITXyezr88i0CzIq8ZtvXxxPB3haC6CuvIlg7rD+2SZPSuPf3/UNgPpYQ vzWuwSlklpYyzvp3W5FS/k8TNca7x/CB6kdZ1l7dutmyhpHUdmFlVzNjiiJT7YMSv3iU 9KW9v62/3eWvhw+eYP1uXRvOcNqqYNRjSWFn8n06kdZ++dit7G8YJwiHj9/jITI+z7dh zpwCcxhoRtS9h1SCGBJQ5Uu3It4D2wPB61mIssMmXYkmpln4cxG/zUZUJPkV4840RWIO W6Yg== 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 l24si1820131pgo.580.2018.02.23.10.48.11; Fri, 23 Feb 2018 10:48:26 -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 S934226AbeBWSrl (ORCPT + 99 others); Fri, 23 Feb 2018 13:47:41 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:44620 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934214AbeBWSrj (ORCPT ); Fri, 23 Feb 2018 13:47:39 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id D78A1FC6; Fri, 23 Feb 2018 18:47:38 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Jan Kara Subject: [PATCH 4.9 118/145] reiserfs: avoid a -Wmaybe-uninitialized warning Date: Fri, 23 Feb 2018 19:27:04 +0100 Message-Id: <20180223170740.069699158@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180223170724.669759283@linuxfoundation.org> References: <20180223170724.669759283@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Arnd Bergmann commit ab4949640d6674b617b314ad3c2c00353304bab9 upstream. The latest gcc-7.0.1 snapshot warns about an unintialized variable use: In file included from fs/reiserfs/lbalance.c:8:0: fs/reiserfs/lbalance.c: In function 'leaf_item_bottle.isra.3': fs/reiserfs/reiserfs.h:1279:13: error: '*((void *)&n_ih+8).v' may be used uninitialized in this function [-Werror=maybe-uninitialized] v2->v = (v2->v & cpu_to_le64(15ULL << 60)) | cpu_to_le64(offset); ~~^~~ fs/reiserfs/reiserfs.h:1279:13: error: '*((void *)&n_ih+8).v' may be used uninitialized in this function [-Werror=maybe-uninitialized] v2->v = (v2->v & cpu_to_le64(15ULL << 60)) | cpu_to_le64(offset); This happens because the offset/type pair that is stored in ih.key.u.k_offset_v2 is actually uninitialized when we call set_le_ih_k_offset() and set_le_ih_k_type(). After we have called both, all data is correct, but the first of the two reads uninitialized data for the type field and writes it back before it gets overwritten. This works around the warning by initializing the k_offset_v2 through the slightly larger memcpy(). [JK: Remove now unused define and make it obvious we initialize the key] Signed-off-by: Arnd Bergmann Signed-off-by: Jan Kara Signed-off-by: Greg Kroah-Hartman --- fs/reiserfs/lbalance.c | 2 +- fs/reiserfs/reiserfs.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) --- a/fs/reiserfs/lbalance.c +++ b/fs/reiserfs/lbalance.c @@ -475,7 +475,7 @@ static void leaf_item_bottle(struct buff * 'cpy_bytes'; create new item header; * n_ih = new item_header; */ - memcpy(&n_ih, ih, SHORT_KEY_SIZE); + memcpy(&n_ih.ih_key, &ih->ih_key, KEY_SIZE); /* Endian safe, both le */ n_ih.ih_version = ih->ih_version; --- a/fs/reiserfs/reiserfs.h +++ b/fs/reiserfs/reiserfs.h @@ -1326,7 +1326,6 @@ struct cpu_key { #define KEY_NOT_FOUND 0 #define KEY_SIZE (sizeof(struct reiserfs_key)) -#define SHORT_KEY_SIZE (sizeof (__u32) + sizeof (__u32)) /* return values for search_by_key and clones */ #define ITEM_FOUND 1