Message ID | 20181018143718.26298-19-richard@nod.at |
---|---|
State | Accepted |
Delegated to: | David Oberhollenzer |
Headers | show
Return-Path: <linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=<UNKNOWN>) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=nod.at Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KUKzt2k5"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="Zl2BTTWz"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::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 42bXvH2YhCz9s8T for <incoming@patchwork.ozlabs.org>; Fri, 19 Oct 2018 02:26:19 +1100 (AEDT) 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=gGVkw2dqAKS3qoNUtQZpbErr+gTAj3zzIeCwqXqHNjI=; b=KUKzt2k5/Kv+5h JFs+7DkzQ2RJv6sHZi7GrksJELivFyYLNNvuB95FOJzz9daXs3ldLnS4oHcQGEIueYsIWNkqILUFM cj4Rzdn5oITzDM0tfkvWG2QEQadtcl3rqqFSSY1MAh3fzz+NG+lxt/cjMqmcistJFpGcZEW60a2cW /z2XWaUryzJlCFfPn6Iwu+0KzGRt6WJg7Vd2fu5URm7LdtrQphQQukxOGIprXZ+xV/rLxNkF8T09J 1+jsyTCC2AH7dVpfbN3JzV7KMcF/7pGgGSoZFIQwjJ0f4bvvEYuoFFq9PYBt6hoKs6lN21CWBQpTj xg/FIiB/xRdsNlc0KXQA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gDABa-00084u-9T; Thu, 18 Oct 2018 15:26:06 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gDA2m-00025V-VW for linux-mtd@bombadil.infradead.org; Thu, 18 Oct 2018 15:17:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=iy3ih2+cJ7npuG//Ny5FFAMJkoqFQjTJEhKu41K8FnI=; b=Zl2BTTWzPVB9t/ZLXrv98wmfYd 6n46TU13nI+8L3a5YrsAeKXyS2BXSLtHCOJWQaIT7G8wuF4zKi9YziFdF5gIsCJormw3jJOFTJFiO 0ZxtEOTpFQOqhgaMr+C4GEed1o2P+keXtsxXgRfcMd88okw1xDEhvJn5uEE5Dfe7dk7SGhc746lJn AcqMoVv7poqpzA2fC609FhmzTkzmBTyRuNkcY7go7MTazyhFySsK5DhLDFV4RBq9ZVONIHnmN1aYd VdaOV+PuR45fZCT9bBIiUjdALSGqfYApVWMBCJMGx8KiFSFOV79QX6McP6BBkS6ubC2aIVdRpnS/q bZbqYtCQ==; Received: from lilium.sigma-star.at ([109.75.188.150]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gD9Rv-0005Id-U7 for linux-mtd@lists.infradead.org; Thu, 18 Oct 2018 14:38:56 +0000 Received: from localhost (localhost [127.0.0.1]) by lilium.sigma-star.at (Postfix) with ESMTP id 2A4A9180347EA; Thu, 18 Oct 2018 16:38:24 +0200 (CEST) From: Richard Weinberger <richard@nod.at> To: linux-mtd@lists.infradead.org Subject: [PATCH 18/42] mkfs.ubifs: Make sure we catch nodes that should or should not have name Date: Thu, 18 Oct 2018 16:36:54 +0200 Message-Id: <20181018143718.26298-19-richard@nod.at> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181018143718.26298-1-richard@nod.at> References: <20181018143718.26298-1-richard@nod.at> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181018_103856_097913_BDD4A5B7 X-CRM114-Status: GOOD ( 13.20 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 T_SPF_PERMERROR SPF: test of record failed (permerror) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list <linux-mtd.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-mtd>, <mailto:linux-mtd-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-mtd/> List-Post: <mailto:linux-mtd@lists.infradead.org> List-Help: <mailto:linux-mtd-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-mtd>, <mailto:linux-mtd-request@lists.infradead.org?subject=subscribe> Cc: Richard Weinberger <richard@nod.at>, david.oberhollenzer@sigma-star.at Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" <linux-mtd-bounces@lists.infradead.org> Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org |
Series |
mtd-utils: Add fscrypt support to mkfs.ubifs
|
expand
|
diff --git a/ubifs-utils/mkfs.ubifs/key.h b/ubifs-utils/mkfs.ubifs/key.h index c18e35e8f0a3..2de530b813a2 100644 --- a/ubifs-utils/mkfs.ubifs/key.h +++ b/ubifs-utils/mkfs.ubifs/key.h @@ -209,4 +209,14 @@ static inline int keys_cmp(const union ubifs_key *key1, return 0; } +/** + * key_type - get key type. + * @c: UBIFS file-system description object + * @key: key to get type of + */ +static inline int key_type(const union ubifs_key *key) +{ + return key->u32[1] >> UBIFS_S_KEY_BLOCK_BITS; +} + #endif /* !__UBIFS_KEY_H__ */ diff --git a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c index b402945924ac..8aba668f8e28 100644 --- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c +++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c @@ -1161,6 +1161,14 @@ static int add_node(union ubifs_key *key, char *name, int name_len, void *node, { int err, lnum, offs; + if (key_type(key) == UBIFS_DENT_KEY || key_type(key) == UBIFS_XENT_KEY) { + if (!name) + return err_msg("Directory entry or xattr without name!"); + } else { + if (name) + return err_msg("Name given for non dir/xattr node!"); + } + prepare_node(node, len); err = reserve_space(len, &lnum, &offs);
Signed-off-by: Richard Weinberger <richard@nod.at> --- ubifs-utils/mkfs.ubifs/key.h | 10 ++++++++++ ubifs-utils/mkfs.ubifs/mkfs.ubifs.c | 8 ++++++++ 2 files changed, 18 insertions(+)