qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [Qemu devel PATCH] msf2: Remove dead code reported by Coverity
@ 2017-10-16 17:54 Subbaraya Sundeep
  2017-10-17 15:28 ` Peter Maydell
  0 siblings, 1 reply; 4+ messages in thread
From: Subbaraya Sundeep @ 2017-10-16 17:54 UTC (permalink / raw)
  To: qemu-devel, qemu-arm
  Cc: peter.maydell, crosthwaite.peter, alistair23, f4bug, imammedo,
	pbonzini, Subbaraya Sundeep

Fixed incorrect frame size mask, validated maximum frame
size in spi_write and removed dead code.

Signed-off-by: Subbaraya Sundeep <sundeep.lkml@gmail.com>
---
 hw/ssi/mss-spi.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/hw/ssi/mss-spi.c b/hw/ssi/mss-spi.c
index 5a8e308..1e49cbc 100644
--- a/hw/ssi/mss-spi.c
+++ b/hw/ssi/mss-spi.c
@@ -76,9 +76,10 @@
 #define C_BIGFIFO            (1 << 29)
 #define C_RESET              (1 << 31)
 
-#define FRAMESZ_MASK         0x1F
+#define FRAMESZ_MASK         0x3F
 #define FMCOUNT_MASK         0x00FFFF00
 #define FMCOUNT_SHIFT        8
+#define FRAMESZ_MAX          32
 
 static void txfifo_reset(MSSSpiState *s)
 {
@@ -106,8 +107,6 @@ static void set_fifodepth(MSSSpiState *s)
         s->fifo_depth = 16;
     } else if (size <= 32) {
         s->fifo_depth = 8;
-    } else {
-        s->fifo_depth = 4;
     }
 }
 
@@ -301,6 +300,9 @@ static void spi_write(void *opaque, hwaddr addr,
         if (s->enabled) {
             break;
         }
+        if ((value & FRAMESZ_MASK) > FRAMESZ_MAX) {
+            break;
+        }
         s->regs[R_SPI_DFSIZE] = value;
         break;
 
-- 
2.5.0

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

end of thread, other threads:[~2017-10-18  3:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-16 17:54 [Qemu-devel] [Qemu devel PATCH] msf2: Remove dead code reported by Coverity Subbaraya Sundeep
2017-10-17 15:28 ` Peter Maydell
2017-10-18  3:15   ` sundeep subbaraya
2017-10-18  3:23     ` sundeep subbaraya

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).