lkml.org 
[lkml]   [2022]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] misc: genwqe: card_dev: Array index overflow fix in ddcb_cmd_fixups()
Date
&cmd->asiv of size 96 can overflow because its index (asiv_offs + 8)
can be equal to 96 (0x58 + 0x08) that is out of range.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Aleksandr Burakov <a.burakov@rosalinux.ru>
Fixes: eaf4722d4645 ("GenWQE Character device and DDCB queue")
---
drivers/misc/genwqe/card_dev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/genwqe/card_dev.c b/drivers/misc/genwqe/card_dev.c
index 55fc5b80e649..d58ce2622307 100644
--- a/drivers/misc/genwqe/card_dev.c
+++ b/drivers/misc/genwqe/card_dev.c
@@ -867,7 +867,7 @@ static int ddcb_cmd_fixups(struct genwqe_file *cfile, struct ddcb_requ *req)
struct genwqe_ddcb_cmd *cmd = &req->cmd;
struct dma_mapping *m;

- for (i = 0, asiv_offs = 0x00; asiv_offs <= 0x58;
+ for (i = 0, asiv_offs = 0x00; asiv_offs < 0x58;
i++, asiv_offs += 0x08) {

u64 u_addr;
--
2.25.1
\
 
 \ /
  Last update: 2022-12-07 15:19    [W:0.053 / U:0.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site