[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4d4f4ae4-e5e9-4d9e-ac25-d262e7ea23fc@kylinos.cn>
Date: Thu, 18 Jan 2024 10:16:57 +0800
From: Kunwu Chan <chentao@...inos.cn>
To: Markus Elfring <Markus.Elfring@....de>, freedreno@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org, linux-arm-msm@...r.kernel.org,
kernel-janitors@...r.kernel.org, Abhinav Kumar <quic_abhinavk@...cinc.com>,
Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
Daniel Vetter <daniel@...ll.ch>, David Airlie <airlied@...il.com>,
Marijn Suijten <marijn.suijten@...ainline.org>,
Rob Clark <robdclark@...il.com>, Sean Paul <sean@...rly.run>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] drm/msm/adreno: Add a null pointer check in
zap_shader_load_mdt()
On 2024/1/18 02:50, Markus Elfring wrote:
>> kasprintf() returns a pointer to dynamically allocated memory
>> which can be NULL upon failure. Ensure the allocation was successful
>> by checking the pointer validity.
> …
>> +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
>> @@ -144,6 +144,10 @@ static int zap_shader_load_mdt(struct msm_gpu *gpu, const char *fwname,
>> char *newname;
>>
>> newname = kasprintf(GFP_KERNEL, "qcom/%s", fwname);
>> + if (!newname) {
>> + ret = -ENOMEM;
>> + goto out;
>> + }
> …
>
> How do you think about to avoid the repetition of the pointer check
> for the variable “mem_region”?
"mem_region"? Is this a clerical error, do you mean 'newname'?
No check found in __qcom_mdt_load for 'newname'.
'newname' is used for printing in '__qcom_mdt_load' in some cases, which
is a bit dangerous.
So it's necessary check it before using it.
> Can the usage of other labels become more appropriate?
>
> Regards,
> Markus
--
Thanks,
Kunwu
Powered by blists - more mailing lists