[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <80db9ee7-481e-9793-87a6-83a9be6836ec@nfschina.com>
Date: Mon, 26 Sep 2022 19:19:17 +0800
From: liqiong <liqiong@...china.com>
To: Rob Clark <robdclark@...il.com>,
Abhinav Kumar <quic_abhinavk@...cinc.com>,
Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
Sean Paul <sean@...rly.run>, David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>
Cc: linux-arm-msm@...r.kernel.org, dri-devel@...ts.freedesktop.org,
freedreno@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
Yu Zhe <yuzhe@...china.com>
Subject: Re: [PATCH] drm/msm/gem: Use size_add() against integer overflow
在 2022年09月26日 17:23, Li Qiong 写道:
> "struct_size() + n" may cause a integer overflow,
> use size_add() to handle it.
>
> Signed-off-by: Li Qiong <liqiong@...china.com>
> ---
> drivers/gpu/drm/msm/msm_gem_submit.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c
> index c9e4aeb14f4a..3dec87e46e50 100644
> --- a/drivers/gpu/drm/msm/msm_gem_submit.c
> +++ b/drivers/gpu/drm/msm/msm_gem_submit.c
> @@ -30,8 +30,8 @@ static struct msm_gem_submit *submit_create(struct drm_device *dev,
> uint64_t sz;
> int ret;
>
> - sz = struct_size(submit, bos, nr_bos) +
> - ((u64)nr_cmds * sizeof(submit->cmd[0]));
> + sz = size_add(struct_size(submit, bos, nr_bos),
> + ((u64)nr_cmds * sizeof(submit->cmd[0])));
>
> if (sz > SIZE_MAX)
> return ERR_PTR(-ENOMEM);
Sorry, This patch a mistake, drop it , please.
Powered by blists - more mailing lists