mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Aleksandr Burakov <a.burakov@rosalinux.ru>
To: Frank Haverkamp <haver@linux.ibm.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Aleksandr Burakov <a.burakov@rosalinux.ru>,
	linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org
Subject: [PATCH 2/2] misc: genwqe: card_dev: Array index overflow fix in ddcb_cmd_fixups()
Date: Wed,  7 Dec 2022 17:18:08 +0300	[thread overview]
Message-ID: <20221207141808.22922-2-a.burakov@rosalinux.ru> (raw)
In-Reply-To: <20221207141808.22922-1-a.burakov@rosalinux.ru>

&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


  reply	other threads:[~2022-12-07 14:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-07 14:18 [PATCH] media: v4l2-flash: fix NULL dereference in v4l2_flash_s_ctrl() Aleksandr Burakov
2022-12-07 14:18 ` Aleksandr Burakov [this message]
2022-12-07 16:23   ` [PATCH 2/2] misc: genwqe: card_dev: Array index overflow fix in ddcb_cmd_fixups() Greg Kroah-Hartman
2022-12-08 10:55     ` Александр Бураков
2022-12-08 13:16       ` Greg Kroah-Hartman
2023-01-16 21:01 ` [PATCH] media: v4l2-flash: fix NULL dereference in v4l2_flash_s_ctrl() Sakari Ailus

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=20221207141808.22922-2-a.burakov@rosalinux.ru \
    --to=a.burakov@rosalinux.ru \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=haver@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    /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

all inboxes | Powered by JetHome®