stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Vineet Gupta <vgupta@synopsys.com>,
	Sasha Levin <sashal@kernel.org>,
	linux-snps-arc@lists.infradead.org
Subject: [PATCH AUTOSEL 5.1 02/59] ARC: fix build warnings
Date: Fri, 14 Jun 2019 16:27:46 -0400	[thread overview]
Message-ID: <20190614202843.26941-2-sashal@kernel.org> (raw)
In-Reply-To: <20190614202843.26941-1-sashal@kernel.org>

From: Vineet Gupta <vgupta@synopsys.com>

[ Upstream commit 89c92142f75eb80064f5b9f1111484b1b4d81790 ]

| arch/arc/mm/tlb.c:914:2: warning: variable length array 'pd0' is used [-Wvla]
| arch/arc/include/asm/cmpxchg.h:95:29: warning: value computed is not used [-Wunused-value]

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arc/include/asm/cmpxchg.h | 14 ++++++++++----
 arch/arc/mm/tlb.c              | 13 ++++++++-----
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/arch/arc/include/asm/cmpxchg.h b/arch/arc/include/asm/cmpxchg.h
index d819de1c5d10..3ea4112c8302 100644
--- a/arch/arc/include/asm/cmpxchg.h
+++ b/arch/arc/include/asm/cmpxchg.h
@@ -92,8 +92,11 @@ __cmpxchg(volatile void *ptr, unsigned long expected, unsigned long new)
 
 #endif /* CONFIG_ARC_HAS_LLSC */
 
-#define cmpxchg(ptr, o, n) ((typeof(*(ptr)))__cmpxchg((ptr), \
-				(unsigned long)(o), (unsigned long)(n)))
+#define cmpxchg(ptr, o, n) ({				\
+	(typeof(*(ptr)))__cmpxchg((ptr),		\
+				  (unsigned long)(o),	\
+				  (unsigned long)(n));	\
+})
 
 /*
  * atomic_cmpxchg is same as cmpxchg
@@ -198,8 +201,11 @@ static inline unsigned long __xchg(unsigned long val, volatile void *ptr,
 	return __xchg_bad_pointer();
 }
 
-#define xchg(ptr, with) ((typeof(*(ptr)))__xchg((unsigned long)(with), (ptr), \
-						 sizeof(*(ptr))))
+#define xchg(ptr, with) ({				\
+	(typeof(*(ptr)))__xchg((unsigned long)(with),	\
+			       (ptr),			\
+			       sizeof(*(ptr)));		\
+})
 
 #endif /* CONFIG_ARC_PLAT_EZNPS */
 
diff --git a/arch/arc/mm/tlb.c b/arch/arc/mm/tlb.c
index 4097764fea23..fa18c00b0cfd 100644
--- a/arch/arc/mm/tlb.c
+++ b/arch/arc/mm/tlb.c
@@ -911,9 +911,11 @@ void do_tlb_overlap_fault(unsigned long cause, unsigned long address,
 			  struct pt_regs *regs)
 {
 	struct cpuinfo_arc_mmu *mmu = &cpuinfo_arc700[smp_processor_id()].mmu;
-	unsigned int pd0[mmu->ways];
 	unsigned long flags;
-	int set;
+	int set, n_ways = mmu->ways;
+
+	n_ways = min(n_ways, 4);
+	BUG_ON(mmu->ways > 4);
 
 	local_irq_save(flags);
 
@@ -921,9 +923,10 @@ void do_tlb_overlap_fault(unsigned long cause, unsigned long address,
 	for (set = 0; set < mmu->sets; set++) {
 
 		int is_valid, way;
+		unsigned int pd0[4];
 
 		/* read out all the ways of current set */
-		for (way = 0, is_valid = 0; way < mmu->ways; way++) {
+		for (way = 0, is_valid = 0; way < n_ways; way++) {
 			write_aux_reg(ARC_REG_TLBINDEX,
 					  SET_WAY_TO_IDX(mmu, set, way));
 			write_aux_reg(ARC_REG_TLBCOMMAND, TLBRead);
@@ -937,14 +940,14 @@ void do_tlb_overlap_fault(unsigned long cause, unsigned long address,
 			continue;
 
 		/* Scan the set for duplicate ways: needs a nested loop */
-		for (way = 0; way < mmu->ways - 1; way++) {
+		for (way = 0; way < n_ways - 1; way++) {
 
 			int n;
 
 			if (!pd0[way])
 				continue;
 
-			for (n = way + 1; n < mmu->ways; n++) {
+			for (n = way + 1; n < n_ways; n++) {
 				if (pd0[way] != pd0[n])
 					continue;
 
-- 
2.20.1


  reply	other threads:[~2019-06-14 20:28 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-14 20:27 [PATCH AUTOSEL 5.1 01/59] lkdtm/usercopy: Moves the KERNEL_DS test to non-canonical Sasha Levin
2019-06-14 20:27 ` Sasha Levin [this message]
2019-06-14 20:27 ` [PATCH AUTOSEL 5.1 03/59] dmaengine: jz4780: Fix transfers being ACKed too soon Sasha Levin
2019-06-14 20:27 ` [PATCH AUTOSEL 5.1 04/59] dmaengine: dw-axi-dmac: fix null dereference when pointer first is null Sasha Levin
2019-06-14 20:27 ` [PATCH AUTOSEL 5.1 05/59] dmaengine: mediatek-cqdma: sleeping in atomic context Sasha Levin
2019-06-14 20:27 ` [PATCH AUTOSEL 5.1 06/59] dmaengine: sprd: Fix the possible crash when getting descriptor status Sasha Levin
2019-06-14 20:27 ` [PATCH AUTOSEL 5.1 07/59] dmaengine: sprd: Add validation of current descriptor in irq handler Sasha Levin
2019-06-14 20:27 ` [PATCH AUTOSEL 5.1 08/59] dmaengine: sprd: Fix the incorrect start for 2-stage destination channels Sasha Levin
2019-06-14 20:27 ` [PATCH AUTOSEL 5.1 09/59] dmaengine: sprd: Fix block length overflow Sasha Levin
2019-06-14 20:27 ` [PATCH AUTOSEL 5.1 10/59] dmaengine: sprd: Fix the right place to configure 2-stage transfer Sasha Levin
2019-06-14 20:27 ` [PATCH AUTOSEL 5.1 11/59] ARC: [plat-hsdk]: Add missing multicast filter bins number to GMAC node Sasha Levin
2019-06-14 20:27 ` [PATCH AUTOSEL 5.1 12/59] ARC: [plat-hsdk]: Add missing FIFO size entry in " Sasha Levin
2019-06-14 20:27 ` [PATCH AUTOSEL 5.1 13/59] MIPS: mark ginvt() as __always_inline Sasha Levin
2019-06-14 20:27 ` [PATCH AUTOSEL 5.1 14/59] fpga: stratix10-soc: fix use-after-free on s10_init() Sasha Levin
2019-06-14 20:27 ` [PATCH AUTOSEL 5.1 15/59] fpga: dfl: afu: Pass the correct device to dma_mapping_error() Sasha Levin
2019-06-14 20:28 ` [PATCH AUTOSEL 5.1 16/59] fpga: dfl: Add lockdep classes for pdata->lock Sasha Levin
2019-06-15  5:47   ` Greg Kroah-Hartman
2019-06-15 22:41     ` Sasha Levin
2019-06-16  7:09       ` Greg Kroah-Hartman
2019-06-14 20:28 ` [PATCH AUTOSEL 5.1 17/59] fpga: dfl: expand minor range when registering chrdev region Sasha Levin
2019-06-15  5:48   ` Greg Kroah-Hartman
2019-06-23 19:26     ` Sasha Levin
2019-06-14 20:28 ` [PATCH AUTOSEL 5.1 18/59] parport: Fix mem leak in parport_register_dev_model Sasha Levin
2019-06-14 20:28 ` [PATCH AUTOSEL 5.1 19/59] parisc: Fix compiler warnings in float emulation code Sasha Levin
2019-06-14 20:28 ` [PATCH AUTOSEL 5.1 20/59] habanalabs: fix bug in checking huge page optimization Sasha Levin
2019-06-14 20:28 ` [PATCH AUTOSEL 5.1 21/59] IB/rdmavt: Fix alloc_qpn() WARN_ON() Sasha Levin
2019-06-14 20:28 ` [PATCH AUTOSEL 5.1 22/59] IB/hfi1: Insure freeze_work work_struct is canceled on shutdown Sasha Levin
2019-06-14 20:28 ` [PATCH AUTOSEL 5.1 23/59] IB/{qib, hfi1, rdmavt}: Correct ibv_devinfo max_mr value Sasha Levin
2019-06-14 20:28 ` [PATCH AUTOSEL 5.1 24/59] IB/hfi1: Validate page aligned for a given virtual address Sasha Levin
2019-06-14 20:28 ` [PATCH AUTOSEL 5.1 25/59] MIPS: uprobes: remove set but not used variable 'epc' Sasha Levin
2019-06-14 20:28 ` [PATCH AUTOSEL 5.1 26/59] crypto: hmac - fix memory leak in hmac_init_tfm() Sasha Levin
2019-06-14 20:28 ` [PATCH AUTOSEL 5.1 27/59] xtensa: Fix section mismatch between memblock_reserve and mem_reserve Sasha Levin
2019-06-14 20:28 ` [PATCH AUTOSEL 5.1 28/59] kselftest/cgroup: fix unexpected testing failure on test_memcontrol Sasha Levin
2019-06-14 20:28 ` [PATCH AUTOSEL 5.1 29/59] kselftest/cgroup: fix unexpected testing failure on test_core Sasha Levin
2019-06-14 20:28 ` [PATCH AUTOSEL 5.1 30/59] kselftest/cgroup: fix incorrect test_core skip Sasha Levin
2019-06-14 20:28 ` [PATCH AUTOSEL 5.1 31/59] userfaultfd: selftest: fix compiler warning Sasha Levin
2019-06-14 20:28 ` [PATCH AUTOSEL 5.1 32/59] selftests: vm: install test_vmalloc.sh for run_vmtests Sasha Levin
2019-06-14 20:28 ` [PATCH AUTOSEL 5.1 33/59] nds32: Avoid IEX status being incorrectly modified Sasha Levin
2019-06-14 20:28 ` [PATCH AUTOSEL 5.1 34/59] net: dsa: mv88e6xxx: avoid error message on remove from VLAN 0 Sasha Levin
2019-06-14 20:28 ` [PATCH AUTOSEL 5.1 35/59] net: hns: Fix loopback test failed at copper ports Sasha Levin
2019-06-14 20:28 ` [PATCH AUTOSEL 5.1 36/59] mdesc: fix a missing-check bug in get_vdev_port_node_info() Sasha Levin
2019-06-14 20:28 ` [PATCH AUTOSEL 5.1 37/59] sparc: perf: fix updated event period in response to PERF_EVENT_IOC_PERIOD Sasha Levin
2019-06-14 20:28 ` [PATCH AUTOSEL 5.1 38/59] net: ethernet: mediatek: Use hw_feature to judge if HWLRO is supported Sasha Levin
2019-06-14 20:28 ` [PATCH AUTOSEL 5.1 39/59] net: ethernet: mediatek: Use NET_IP_ALIGN to judge if HW RX_2BYTE_OFFSET is enabled Sasha Levin
2019-06-14 20:28 ` [PATCH AUTOSEL 5.1 40/59] selftests: set sysctl bc_forwarding properly in router_broadcast.sh Sasha Levin

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=20190614202843.26941-2-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=stable@vger.kernel.org \
    --cc=vgupta@synopsys.com \
    /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).