mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ARC: Fix array-out-of-bounds issue in tlb overlap handler
@ 2013-09-26 13:46 Mischa Jonker
  2013-09-26 14:26 ` [arc-linux-dev] " Vineet Gupta
  0 siblings, 1 reply; 2+ messages in thread
From: Mischa Jonker @ 2013-09-26 13:46 UTC (permalink / raw)
  To: Vineet.Gupta1, linux-kernel, arc-linux-dev; +Cc: Mischa Jonker

Even after fixing the issue, GCC 4.8 still complains with a warning,
but with the fix, I think it's a false positive. Therefore I have
also added a #pragma to ignore the warning.

Signed-off-by: Mischa Jonker <mjonker@synopsys.com>
---
 arch/arc/mm/tlb.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/arc/mm/tlb.c b/arch/arc/mm/tlb.c
index 129af50..5af7c98 100644
--- a/arch/arc/mm/tlb.c
+++ b/arch/arc/mm/tlb.c
@@ -635,13 +635,20 @@ 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; way++) {
+		for (way = 0; way < (mmu->ways - 1); way++) {
 			if (!pd0[way])
 				continue;
 
 			for (n = way + 1; n < mmu->ways; n++) {
+/*
+ * GCC 4.8 does not understand that way < (mmu->ways - 1), and as such
+ * n < mmu->ways. So, ignore the warning
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
 				if ((pd0[way] & PAGE_MASK) ==
 				    (pd0[n] & PAGE_MASK)) {
+#pragma GCC diagnostic pop
 
 					if (dup_pd_verbose) {
 						pr_info("Duplicate PD's @"
-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-09-26 14:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-26 13:46 [PATCH] ARC: Fix array-out-of-bounds issue in tlb overlap handler Mischa Jonker
2013-09-26 14:26 ` [arc-linux-dev] " Vineet Gupta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®