Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Kunwu Chan <chentao@kylinos.cn>
To: Markus Elfring <Markus.Elfring@web.de>,
	freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-arm-msm@vger.kernel.org, kernel-janitors@vger.kernel.org,
	Abhinav Kumar <quic_abhinavk@quicinc.com>,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	Daniel Vetter <daniel@ffwll.ch>, David Airlie <airlied@gmail.com>,
	Marijn Suijten <marijn.suijten@somainline.org>,
	Rob Clark <robdclark@gmail.com>, Sean Paul <sean@poorly.run>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drm/msm/adreno: Add a null pointer check in zap_shader_load_mdt()
Date: Thu, 18 Jan 2024 10:16:57 +0800	[thread overview]
Message-ID: <4d4f4ae4-e5e9-4d9e-ac25-d262e7ea23fc@kylinos.cn> (raw)
In-Reply-To: <9e390783-05c5-47fc-a0c6-b95e249fe691@web.de>

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


  reply	other threads:[~2024-01-18  2:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-16  3:27 [PATCH] drm/msm/adreno: Add a null pointer check to the zap_shader_load_mdt Kunwu Chan
2024-01-17 18:50 ` [PATCH] drm/msm/adreno: Add a null pointer check in zap_shader_load_mdt() Markus Elfring
2024-01-18  2:16   ` Kunwu Chan [this message]
2024-01-18  8:06     ` Markus Elfring

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=4d4f4ae4-e5e9-4d9e-ac25-d262e7ea23fc@kylinos.cn \
    --to=chentao@kylinos.cn \
    --cc=Markus.Elfring@web.de \
    --cc=airlied@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marijn.suijten@somainline.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=robdclark@gmail.com \
    --cc=sean@poorly.run \
    /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