Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Kunwu Chan <chentao@kylinos.cn>,
	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: Wed, 17 Jan 2024 19:50:36 +0100	[thread overview]
Message-ID: <9e390783-05c5-47fc-a0c6-b95e249fe691@web.de> (raw)
In-Reply-To: <20240116032732.65262-1-chentao@kylinos.cn>

> 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”?
Can the usage of other labels become more appropriate?

Regards,
Markus

  reply	other threads:[~2024-01-17 18:51 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 ` Markus Elfring [this message]
2024-01-18  2:16   ` [PATCH] drm/msm/adreno: Add a null pointer check in zap_shader_load_mdt() Kunwu Chan
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=9e390783-05c5-47fc-a0c6-b95e249fe691@web.de \
    --to=markus.elfring@web.de \
    --cc=airlied@gmail.com \
    --cc=chentao@kylinos.cn \
    --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