[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <efc748d7-1a67-476a-82a4-206a9ed252cb@web.de>
Date: Thu, 18 Jan 2024 09:06:50 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: Kunwu Chan <chentao@...inos.cn>, 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()
>>> 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'?
Please take another look at implementation details:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/msm/adreno/adreno_gpu.c?h=v6.7#n124
…
>> Can the usage of other labels become more appropriate?
I propose to reconsider also the influence of the label “out” here.
https://elixir.bootlin.com/linux/v6.7/source/drivers/gpu/drm/msm/adreno/adreno_gpu.c#L167
Regards,
Markus
Powered by blists - more mailing lists