linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Hyunwoo Kim <imv4bel@gmail.com>, Helge Deller <deller@gmx.de>,
	Sasha Levin <sashal@kernel.org>,
	cai.huoqing@linux.dev, yang.lee@linux.alibaba.com,
	yangyingliang@huawei.com, linux-fbdev@vger.kernel.org,
	dri-devel@lists.freedesktop.org
Subject: [PATCH AUTOSEL 4.14 09/17] video: fbdev: pxa3xx-gcu: Fix integer overflow in pxa3xx_gcu_write
Date: Mon, 27 Jun 2022 22:26:07 -0400	[thread overview]
Message-ID: <20220628022615.596977-9-sashal@kernel.org> (raw)
In-Reply-To: <20220628022615.596977-1-sashal@kernel.org>

From: Hyunwoo Kim <imv4bel@gmail.com>

[ Upstream commit a09d2d00af53b43c6f11e6ab3cb58443c2cac8a7 ]

In pxa3xx_gcu_write, a count parameter of type size_t is passed to words of
type int.  Then, copy_from_user() may cause a heap overflow because it is used
as the third argument of copy_from_user().

Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/video/fbdev/pxa3xx-gcu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/pxa3xx-gcu.c b/drivers/video/fbdev/pxa3xx-gcu.c
index 4febbe21b9b5..db861bb39150 100644
--- a/drivers/video/fbdev/pxa3xx-gcu.c
+++ b/drivers/video/fbdev/pxa3xx-gcu.c
@@ -391,7 +391,7 @@ pxa3xx_gcu_write(struct file *file, const char *buff,
 	struct pxa3xx_gcu_batch	*buffer;
 	struct pxa3xx_gcu_priv *priv = to_pxa3xx_gcu_priv(file);
 
-	int words = count / 4;
+	size_t words = count / 4;
 
 	/* Does not need to be atomic. There's a lock in user space,
 	 * but anyhow, this is just for statistics. */
-- 
2.35.1


  parent reply	other threads:[~2022-06-28  2:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220628022615.596977-1-sashal@kernel.org>
2022-06-28  2:26 ` [PATCH AUTOSEL 4.14 07/17] video: fbdev: skeletonfb: Fix syntax errors in comments Sasha Levin
2022-06-28  2:26 ` [PATCH AUTOSEL 4.14 08/17] video: fbdev: intelfb: Use aperture size from pci_resource_len Sasha Levin
2022-06-28  2:26 ` Sasha Levin [this message]
2022-06-28  2:26 ` [PATCH AUTOSEL 4.14 10/17] video: fbdev: simplefb: Check before clk_put() not needed Sasha Levin

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=20220628022615.596977-9-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=cai.huoqing@linux.dev \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=imv4bel@gmail.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=yang.lee@linux.alibaba.com \
    --cc=yangyingliang@huawei.com \
    /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;
as well as URLs for NNTP newsgroup(s).