Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: "Falkowski, Maciej" <maciej.falkowski@linux.intel.com>
To: Youssef Samir <youssef.abdulrahman@oss.qualcomm.com>,
	jeff.hugo@oss.qualcomm.com, carl.vanderlip@oss.qualcomm.com,
	troy.hanson@oss.qualcomm.com, zachary.mckevitt@oss.qualcomm.com
Cc: ogabbay@kernel.org, lizhi.hou@amd.com,
	karol.wachowski@linux.intel.com, linux-arm-msm@vger.kernel.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] accel/qaic: Replace user defined overflow check
Date: Fri, 17 Oct 2025 17:13:56 +0200	[thread overview]
Message-ID: <97dee1c9-fc43-404b-bbd1-06fe04718c5a@linux.intel.com> (raw)
In-Reply-To: <20251015152239.167226-1-youssef.abdulrahman@oss.qualcomm.com>

Reviewed-by: Maciej Falkowski <maciej.falkowski@linux.intel.com>

On 10/15/2025 5:22 PM, Youssef Samir wrote:
> From: Sourab Bera <quic_sourbera@quicinc.com>
>
> Replace the current logic to check overflow, with the kernel-provided
> macro `check_mul_overflow` in the function __qaic_execute_bo_ioctl().
>
> Signed-off-by: Sourab Bera <quic_sourbera@quicinc.com>
> Signed-off-by: Youssef Samir <youssef.abdulrahman@oss.qualcomm.com>
> ---
>   drivers/accel/qaic/qaic_data.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/accel/qaic/qaic_data.c b/drivers/accel/qaic/qaic_data.c
> index 797289e9d780..e6f96dbb3382 100644
> --- a/drivers/accel/qaic/qaic_data.c
> +++ b/drivers/accel/qaic/qaic_data.c
> @@ -15,6 +15,7 @@
>   #include <linux/math64.h>
>   #include <linux/mm.h>
>   #include <linux/moduleparam.h>
> +#include <linux/overflow.h>
>   #include <linux/scatterlist.h>
>   #include <linux/spinlock.h>
>   #include <linux/srcu.h>
> @@ -1305,17 +1306,17 @@ static int __qaic_execute_bo_ioctl(struct drm_device *dev, void *data, struct dr
>   	u64 received_ts;
>   	u32 queue_level;
>   	u64 submit_ts;
> +	size_t size;
>   	int rcu_id;
>   	u32 head;
>   	u32 tail;
> -	u64 size;
>   	int ret;
>   
>   	received_ts = ktime_get_ns();
>   
>   	size = is_partial ? sizeof(struct qaic_partial_execute_entry) : sizeof(*exec);
> -	n = (unsigned long)size * args->hdr.count;
> -	if (args->hdr.count == 0 || n / args->hdr.count != size)
> +	if (args->hdr.count == 0 ||
> +	    check_mul_overflow((unsigned long)size, (unsigned long)args->hdr.count, &n))
>   		return -EINVAL;
>   
>   	user_data = u64_to_user_ptr(args->data);

  parent reply	other threads:[~2025-10-17 15:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-15 15:22 [PATCH] accel/qaic: Replace user defined overflow check Youssef Samir
2025-10-15 16:01 ` Carl Vanderlip
2025-10-15 16:42 ` Jeff Hugo
2025-10-17 15:13 ` Falkowski, Maciej [this message]
2025-10-20 15:05 ` Jeff Hugo
2025-10-21 16:03   ` Youssef Abdulrahman

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=97dee1c9-fc43-404b-bbd1-06fe04718c5a@linux.intel.com \
    --to=maciej.falkowski@linux.intel.com \
    --cc=carl.vanderlip@oss.qualcomm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jeff.hugo@oss.qualcomm.com \
    --cc=karol.wachowski@linux.intel.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=lizhi.hou@amd.com \
    --cc=ogabbay@kernel.org \
    --cc=troy.hanson@oss.qualcomm.com \
    --cc=youssef.abdulrahman@oss.qualcomm.com \
    --cc=zachary.mckevitt@oss.qualcomm.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