qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hw/cxl: Fix out of bound array access
@ 2023-09-13 10:10 Dmitry Frolov
  2023-09-13 11:02 ` Jonathan Cameron via
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Dmitry Frolov @ 2023-09-13 10:10 UTC (permalink / raw)
  To: jonathan.cameron, fan.ni, qemu-devel; +Cc: sdl.qemu, Dmitry Frolov

According to cxl_interleave_ways_enc(),
fw->num_targets is allowed to be up to 16.
This also corresponds to CXL specs.
So, the fw->target_hbs[] array is iterated from 0 to 15.
But it is staticaly declared of length 8.
Thus, out of bound array access may occur.

Fixes: c28db9e000 ("hw/pci-bridge: Make PCIe and CXL PXB Devices inherit from TYPE_PXB_DEV")

Signed-off-by: Dmitry Frolov <frolov@swemel.ru>
---
 include/hw/cxl/cxl.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/hw/cxl/cxl.h b/include/hw/cxl/cxl.h
index 56c9e7676e..4944725849 100644
--- a/include/hw/cxl/cxl.h
+++ b/include/hw/cxl/cxl.h
@@ -29,7 +29,7 @@ typedef struct PXBCXLDev PXBCXLDev;
 typedef struct CXLFixedWindow {
     uint64_t size;
     char **targets;
-    PXBCXLDev *target_hbs[8];
+    PXBCXLDev *target_hbs[16];
     uint8_t num_targets;
     uint8_t enc_int_ways;
     uint8_t enc_int_gran;
-- 
2.34.1



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

end of thread, other threads:[~2023-09-14 13:17 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-13 10:10 [PATCH] hw/cxl: Fix out of bound array access Dmitry Frolov
2023-09-13 11:02 ` Jonathan Cameron via
2023-09-13 11:36 ` Philippe Mathieu-Daudé
2023-09-13 13:22   ` [PATCH v2] " Dmitry Frolov
2023-09-13 16:58     ` Jonathan Cameron via
2023-09-13 16:56   ` [PATCH] " Jonathan Cameron via
2023-09-14  7:06     ` [PATCH v3] " Dmitry Frolov
2023-09-14 12:36       ` Michael Tokarev
2023-09-14 12:37 ` [PATCH] " Michael Tokarev
2023-09-14 12:38   ` Michael Tokarev
2023-09-14 12:59     ` Philippe Mathieu-Daudé
2023-09-14 13:16       ` Michael Tokarev

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