From patchwork Wed May 17 08:36:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Weinberger X-Patchwork-Id: 763369 X-Patchwork-Delegate: richard@nod.at Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wSSPQ3tvPz9s3T for ; Wed, 17 May 2017 18:37:46 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="cOpXDriJ"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=mzfJFG8EHvDVNXpfhu9qmm4FU17jlGCK+jNKrFsSUQ0=; b=cOpXDriJROvkxKIHHeaWRPCU/I pE1lfENiTPStUpLWkdf+SGxpsMoA7qcojhqWk+K5h4MZdVSDPuzXjp9AHASDVmDkYYvgkDl0xmtlH 8KdtpuFDmhxfWLMUDkGKBBa/WRD4JZjdlCMaPcMtSfZWoDJ6bJpgdZdS4B/+pTR9zIXU3l1MBSqSj AfYK3LewL3UG2SkT8JZNc/1WhRdoyaKpmLl0XDXnmH0y+NEpkYfxBuTTzJUr74s4tLjtZUGO+EzgP vgzGBJtnLxs1LaTBSK9AKCMJcWuj3CTobjosmq5M1imNPJb9PSAeB9mGoH9xvvhh4o/yEKcQKh+Aa q45ftpVw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dAuSl-0007nO-In; Wed, 17 May 2017 08:37:43 +0000 Received: from mail.sigma-star.at ([95.130.255.111]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dAuSM-0007Gw-9S for linux-mtd@lists.infradead.org; Wed, 17 May 2017 08:37:21 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.sigma-star.at (Postfix) with ESMTP id D3D0124E0002; Wed, 17 May 2017 10:36:53 +0200 (CEST) Received: from spankyham.sigmapriv.at (unknown [82.150.214.13]) by mail.sigma-star.at (Postfix) with ESMTPSA id 43C7624E0004; Wed, 17 May 2017 10:36:53 +0200 (CEST) From: Richard Weinberger To: linux-mtd@lists.infradead.org Subject: [PATCH 4/6] ubifs: Add assert to dent_key_init() Date: Wed, 17 May 2017 10:36:47 +0200 Message-Id: <20170517083649.25135-4-richard@nod.at> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170517083649.25135-1-richard@nod.at> References: <20170517083649.25135-1-richard@nod.at> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170517_013718_523409_52376100 X-CRM114-Status: GOOD ( 11.63 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Weinberger , linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org ...to make sure that we don't use it for double hashed lookups instead of dent_key_init_hash(). Signed-off-by: Richard Weinberger --- fs/ubifs/key.h | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ubifs/key.h b/fs/ubifs/key.h index 7547be512db2..b1f7c0caa3ac 100644 --- a/fs/ubifs/key.h +++ b/fs/ubifs/key.h @@ -162,6 +162,7 @@ static inline void dent_key_init(const struct ubifs_info *c, uint32_t hash = c->key_hash(fname_name(nm), fname_len(nm)); ubifs_assert(!(hash & ~UBIFS_S_KEY_HASH_MASK)); + ubifs_assert(!nm->hash && !nm->minor_hash); key->u32[0] = inum; key->u32[1] = hash | (UBIFS_DENT_KEY << UBIFS_S_KEY_HASH_BITS); }