linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Richard Weinberger <richard@nod.at>
Subject: [PATCH 4.4 102/107] ubi: Introduce vol_ignored()
Date: Mon, 23 Jul 2018 14:42:36 +0200	[thread overview]
Message-ID: <20180723122418.624558482@linuxfoundation.org> (raw)
In-Reply-To: <20180723122413.003644357@linuxfoundation.org>

4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Richard Weinberger <richard@nod.at>

commit 243a4f8126fcf7facb04b324dbb7c85d10b11ce9 upstream.

This makes the logic more easy to follow.

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/mtd/ubi/attach.c |   24 ++++++++++++++++++------
 drivers/mtd/ubi/ubi.h    |   15 +++++++++++++++
 2 files changed, 33 insertions(+), 6 deletions(-)

--- a/drivers/mtd/ubi/attach.c
+++ b/drivers/mtd/ubi/attach.c
@@ -803,6 +803,20 @@ out_unlock:
 	return err;
 }
 
+static bool vol_ignored(int vol_id)
+{
+	switch (vol_id) {
+		case UBI_LAYOUT_VOLUME_ID:
+		return true;
+	}
+
+#ifdef CONFIG_MTD_UBI_FASTMAP
+	return ubi_is_fm_vol(vol_id);
+#else
+	return false;
+#endif
+}
+
 /**
  * scan_peb - scan and process UBI headers of a PEB.
  * @ubi: UBI device description object
@@ -995,17 +1009,15 @@ static int scan_peb(struct ubi_device *u
 		*vid = vol_id;
 	if (sqnum)
 		*sqnum = be64_to_cpu(vidh->sqnum);
-	if (vol_id > UBI_MAX_VOLUMES && vol_id != UBI_LAYOUT_VOLUME_ID) {
+	if (vol_id > UBI_MAX_VOLUMES && !vol_ignored(vol_id)) {
 		int lnum = be32_to_cpu(vidh->lnum);
 
 		/* Unsupported internal volume */
 		switch (vidh->compat) {
 		case UBI_COMPAT_DELETE:
-			if (vol_id != UBI_FM_SB_VOLUME_ID
-			    && vol_id != UBI_FM_DATA_VOLUME_ID) {
-				ubi_msg(ubi, "\"delete\" compatible internal volume %d:%d found, will remove it",
-					vol_id, lnum);
-			}
+			ubi_msg(ubi, "\"delete\" compatible internal volume %d:%d found, will remove it",
+				vol_id, lnum);
+
 			err = add_to_list(ai, pnum, vol_id, lnum,
 					  ec, 1, &ai->erase);
 			if (err)
--- a/drivers/mtd/ubi/ubi.h
+++ b/drivers/mtd/ubi/ubi.h
@@ -1101,4 +1101,19 @@ static inline int idx2vol_id(const struc
 		return idx;
 }
 
+/**
+ * ubi_is_fm_vol - check whether a volume ID is a Fastmap volume.
+ * @vol_id: volume ID
+ */
+static inline bool ubi_is_fm_vol(int vol_id)
+{
+	switch (vol_id) {
+		case UBI_FM_SB_VOLUME_ID:
+		case UBI_FM_DATA_VOLUME_ID:
+		return true;
+	}
+
+	return false;
+}
+
 #endif /* !__UBI_UBI_H__ */



  parent reply	other threads:[~2018-07-23 12:47 UTC|newest]

Thread overview: 111+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-23 12:40 [PATCH 4.4 000/107] 4.4.144-stable review Greg Kroah-Hartman
2018-07-23 12:40 ` [PATCH 4.4 002/107] x86/MCE: Remove min interval polling limitation Greg Kroah-Hartman
2018-07-23 12:40 ` [PATCH 4.4 003/107] fat: fix memory allocation failure handling of match_strdup() Greg Kroah-Hartman
2018-07-23 12:40 ` [PATCH 4.4 004/107] ALSA: rawmidi: Change resized buffers atomically Greg Kroah-Hartman
2018-07-23 12:40 ` [PATCH 4.4 005/107] ARC: Fix CONFIG_SWAP Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 006/107] ARC: mm: allow mprotect to make stack mappings executable Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 007/107] mm: memcg: fix use after free in mem_cgroup_iter() Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 008/107] ipv4: Return EINVAL when ping_group_range sysctl doesnt map to user ns Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 009/107] ipv6: fix useless rol32 call on hash Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 010/107] lib/rhashtable: consider param->min_size when setting initial table size Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 011/107] net/ipv4: Set oif in fib_compute_spec_dst Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 012/107] net: phy: fix flag masking in __set_phy_supported Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 013/107] ptp: fix missing break in switch Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 014/107] tg3: Add higher cpu clock for 5762 Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 015/107] net: Dont copy pfmemalloc flag in __copy_skb_header() Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 016/107] skbuff: Unconditionally copy pfmemalloc in __skb_clone() Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 017/107] xhci: Fix perceived dead host due to runtime suspend race with event handler Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 018/107] x86/paravirt: Make native_save_fl() extern inline Greg Kroah-Hartman
2018-08-24 23:08   ` Ben Hutchings
2018-08-27 21:06     ` Nick Desaulniers
2018-07-23 12:41 ` [PATCH 4.4 019/107] x86/cpufeatures: Add CPUID_7_EDX CPUID leaf Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 020/107] x86/cpufeatures: Add Intel feature bits for Speculation Control Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 021/107] x86/cpufeatures: Add AMD " Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 022/107] x86/msr: Add definitions for new speculation control MSRs Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 023/107] x86/pti: Do not enable PTI on CPUs which are not vulnerable to Meltdown Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 024/107] x86/cpufeature: Blacklist SPEC_CTRL/PRED_CMD on early Spectre v2 microcodes Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 025/107] x86/speculation: Add basic IBPB (Indirect Branch Prediction Barrier) support Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 026/107] x86/cpufeatures: Clean up Spectre v2 related CPUID flags Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 027/107] x86/cpuid: Fix up "virtual" IBRS/IBPB/STIBP feature bits on Intel Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 028/107] x86/pti: Mark constant arrays as __initconst Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 029/107] x86/asm/entry/32: Simplify pushes of zeroed pt_regs->REGs Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 030/107] x86/entry/64/compat: Clear registers for compat syscalls, to reduce speculation attack surface Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 031/107] x86/speculation: Update Speculation Control microcode blacklist Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 032/107] x86/speculation: Correct Speculation Control microcode blacklist again Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 033/107] x86/speculation: Clean up various Spectre related details Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 034/107] x86/speculation: Fix up array_index_nospec_mask() asm constraint Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 035/107] x86/speculation: Add <asm/msr-index.h> dependency Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 036/107] x86/xen: Zero MSR_IA32_SPEC_CTRL before suspend Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 037/107] x86/mm: Factor out LDT init from context init Greg Kroah-Hartman
2018-08-24 23:44   ` Ben Hutchings
2018-08-26  6:06     ` Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 038/107] x86/mm: Give each mm TLB flush generation a unique ID Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 041/107] x86/speculation: Use IBRS if available before calling into firmware Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 042/107] x86/speculation: Move firmware_restrict_branch_speculation_*() from C to CPP Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 043/107] x86/speculation: Remove Skylake C2 from Speculation Control microcode blacklist Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 046/107] xen: set cpu capabilities from xen_start_kernel() Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 047/107] x86/amd: dont set X86_BUG_SYSRET_SS_ATTRS when running under Xen Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 048/107] x86/nospec: Simplify alternative_msr_write() Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 049/107] x86/bugs: Concentrate bug detection into a separate function Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 050/107] x86/bugs: Concentrate bug reporting " Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 051/107] x86/bugs: Read SPEC_CTRL MSR during boot and re-use reserved bits Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 052/107] x86/bugs, KVM: Support the combination of guest and host IBRS Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 053/107] x86/cpu: Rename Merrifield2 to Moorefield Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 054/107] x86/cpu/intel: Add Knights Mill to Intel family Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 055/107] x86/bugs: Expose /sys/../spec_store_bypass Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 056/107] x86/cpufeatures: Add X86_FEATURE_RDS Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 057/107] x86/bugs: Provide boot parameters for the spec_store_bypass_disable mitigation Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 058/107] x86/bugs/intel: Set proper CPU features and setup RDS Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 059/107] x86/bugs: Whitelist allowed SPEC_CTRL MSR values Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 060/107] x86/bugs/AMD: Add support to disable RDS on Fam[15, 16, 17]h if requested Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 061/107] x86/speculation: Create spec-ctrl.h to avoid include hell Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 062/107] prctl: Add speculation control prctls Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 063/107] x86/process: Optimize TIF checks in __switch_to_xtra() Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 064/107] x86/process: Correct and optimize TIF_BLOCKSTEP switch Greg Kroah-Hartman
2018-07-23 12:41 ` [PATCH 4.4 065/107] x86/process: Optimize TIF_NOTSC switch Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 066/107] x86/process: Allow runtime control of Speculative Store Bypass Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 067/107] x86/speculation: Add prctl for Speculative Store Bypass mitigation Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 068/107] nospec: Allow getting/setting on non-current task Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 069/107] proc: Provide details on speculation flaw mitigations Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 070/107] seccomp: Enable " Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 071/107] prctl: Add force disable speculation Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 072/107] seccomp: Use PR_SPEC_FORCE_DISABLE Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 073/107] seccomp: Add filter flag to opt-out of SSB mitigation Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 074/107] seccomp: Move speculation migitation control to arch code Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 075/107] x86/speculation: Make "seccomp" the default mode for Speculative Store Bypass Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 076/107] x86/bugs: Rename _RDS to _SSBD Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 077/107] proc: Use underscores for SSBD in status Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 078/107] Documentation/spec_ctrl: Do some minor cleanups Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 079/107] x86/bugs: Fix __ssb_select_mitigation() return type Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 080/107] x86/bugs: Make cpu_show_common() static Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 081/107] x86/bugs: Fix the parameters alignment and missing void Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 082/107] x86/cpu: Make alternative_msr_write work for 32-bit code Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 084/107] x86/cpufeatures: Disentangle MSR_SPEC_CTRL enumeration from IBRS Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 085/107] x86/cpufeatures: Disentangle SSBD enumeration Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 086/107] x86/cpu/AMD: Fix erratum 1076 (CPB bit) Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 087/107] x86/cpufeatures: Add FEATURE_ZEN Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 088/107] x86/speculation: Handle HT correctly on AMD Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 089/107] x86/bugs, KVM: Extend speculation control for VIRT_SPEC_CTRL Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 090/107] x86/speculation: Add virtualized speculative store bypass disable support Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 091/107] x86/speculation: Rework speculative_store_bypass_update() Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 092/107] x86/bugs: Unify x86_spec_ctrl_{set_guest, restore_host} Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 093/107] x86/bugs: Expose x86_spec_ctrl_base directly Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 094/107] x86/bugs: Remove x86_spec_ctrl_set() Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 095/107] x86/bugs: Rework spec_ctrl base and mask logic Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 096/107] x86/speculation, KVM: Implement support for VIRT_SPEC_CTRL/LS_CFG Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 097/107] x86/bugs: Rename SSBD_NO to SSB_NO Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 098/107] x86/xen: Add call of speculative_store_bypass_ht_init() to PV paths Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 099/107] x86/cpu: Re-apply forced caps every time CPU caps are re-read Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 100/107] block: do not use interruptible wait anywhere Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 101/107] clk: tegra: Fix PLL_U post divider and initial rate on Tegra30 Greg Kroah-Hartman
2018-07-23 12:42 ` Greg Kroah-Hartman [this message]
2018-07-23 12:42 ` [PATCH 4.4 103/107] ubi: Rework Fastmap attach base code Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 104/107] ubi: Be more paranoid while seaching for the most recent Fastmap Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 105/107] ubi: Fix races around ubi_refill_pools() Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 106/107] ubi: Fix Fastmaps update_vol() Greg Kroah-Hartman
2018-07-23 12:42 ` [PATCH 4.4 107/107] ubi: fastmap: Erase outdated anchor PEBs during attach Greg Kroah-Hartman
2018-09-04 18:39   ` Ben Hutchings
2018-09-17 11:53     ` Greg Kroah-Hartman
2018-07-23 15:11 ` [PATCH 4.4 000/107] 4.4.144-stable review Nathan Chancellor
2018-07-23 22:14 ` Dan Rue
2018-07-24 15:57 ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180723122418.624558482@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=richard@nod.at \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).