All of lore.kernel.org
 help / color / mirror / Atom feed
From: carsten.haitzler@foss.arm.com
To: dri-devel@lists.freedesktop.org
Cc: liviu.dudau@arm.com, Carsten Haitzler <carsten.haitzler@arm.com>
Subject: [PATCH] drm/komeda: Fix bit check to import to value of proper type
Date: Fri, 18 Dec 2020 15:08:12 +0000	[thread overview]
Message-ID: <20201218150812.68195-1-carsten.haitzler@foss.arm.com> (raw)

From: Carsten Haitzler <carsten.haitzler@arm.com>

KASAN found this problem. find_first_bit() expects to look at a
pointer pointing to a long, but we look at a u32 - this is going to be
an issue with endianess but, KSAN already flags this as out-of-bounds
stack reads. This fixes it by just importing inot a local long.

Signed-off-by: Carsten Haitzler <carsten.haitzler@arm.com>
---
 drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c
index 452e505a1fd3..719a79728e24 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c
@@ -137,9 +137,10 @@ komeda_pipeline_get_first_component(struct komeda_pipeline *pipe,
 				    u32 comp_mask)
 {
 	struct komeda_component *c = NULL;
+	unsigned long comp_mask_local = (unsigned long)comp_mask;
 	int id;
 
-	id = find_first_bit((unsigned long *)&comp_mask, 32);
+	id = find_first_bit(&comp_mask_local, 32);
 	if (id < 32)
 		c = komeda_pipeline_get_component(pipe, id);
 
-- 
2.29.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

             reply	other threads:[~2020-12-18 15:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-18 15:08 carsten.haitzler [this message]
2020-12-18 16:08 ` [PATCH] drm/komeda: Fix bit check to import to value of proper type Liviu Dudau
2021-01-18 14:20 carsten.haitzler
2021-01-20 15:44 ` Steven Price
2021-01-21 12:22   ` Carsten Haitzler
2021-01-21 16:40     ` Steven Price
2021-01-21 17:37       ` Carsten Haitzler
2021-01-27 12:35   ` Carsten Haitzler
2021-01-27 12:34 carsten.haitzler
2021-01-27 16:31 ` Steven Price
2021-02-04 13:11 carsten.haitzler
2021-02-05  8:29 ` Steven Price
2021-02-05  8:50   ` James Qian Wang

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=20201218150812.68195-1-carsten.haitzler@foss.arm.com \
    --to=carsten.haitzler@foss.arm.com \
    --cc=carsten.haitzler@arm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=liviu.dudau@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.