mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
To: Charles Han <hanchunchao@inspur.com>, laurent.pinchart@ideasonboard.com
Cc: dri-devel@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Markus.Elfring@web.de,
	maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch,
	michal.simek@amd.com, vishal.sagar@amd.com
Subject: Re: [PATCH V3] drm: xlnx: zynqmp_dpsub: Add NULL check in zynqmp_audio_init
Date: Tue, 11 Feb 2025 15:20:21 +0200	[thread overview]
Message-ID: <192889ed-237e-40b0-8444-7aad36a8bc7a@ideasonboard.com> (raw)
In-Reply-To: <b8c4dabc-c9a9-407a-94a1-4a59a67e0440@ideasonboard.com>

Hi,

On 11/02/2025 15:08, Tomi Valkeinen wrote:
> Hi,
> 
> On 11/02/2025 12:20, Charles Han wrote:
>> devm_kasprintf() calls can return null pointers on failure.
>> But some return values were not checked in zynqmp_audio_init().
>>
>> Add NULL check in zynqmp_audio_init(), avoid referencing null
>> pointers in the subsequent code.
>>
>> Signed-off-by: Charles Han <hanchunchao@inspur.com>
>> ---
>>   drivers/gpu/drm/xlnx/zynqmp_dp_audio.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp_audio.c b/drivers/gpu/drm/ 
>> xlnx/zynqmp_dp_audio.c
>> index fa5f0ace6084..f07ff4eb3a6d 100644
>> --- a/drivers/gpu/drm/xlnx/zynqmp_dp_audio.c
>> +++ b/drivers/gpu/drm/xlnx/zynqmp_dp_audio.c
>> @@ -323,12 +323,16 @@ int zynqmp_audio_init(struct zynqmp_dpsub *dpsub)
>>       audio->dai_name = devm_kasprintf(dev, GFP_KERNEL,
>>                        "%s-dai", dev_name(dev));
>> +    if (!audio->dai_name)
>> +        return -ENOMEM;
>>       for (unsigned int i = 0; i < ZYNQMP_NUM_PCMS; ++i) {
>>           audio->link_names[i] = devm_kasprintf(dev, GFP_KERNEL,
>>                                 "%s-dp-%u", dev_name(dev), i);
>>           audio->pcm_names[i] = devm_kasprintf(dev, GFP_KERNEL,
>>                                "%s-pcm-%u", dev_name(dev), i);
>> +        if (!audio->link_names[i] || !audio->pcm_names[i])
>> +            return -ENOMEM;
>>       }
>>       audio->base = devm_platform_ioremap_resource_byname(pdev, "aud");
> 
> Thanks, looks good to me. I'll apply with Laurent's RB, which he gave 
> for v1.

Actually, looks like you dropped the Fixes tag that you had in the v1 
and v2. I will add it back.

  Tomi


      reply	other threads:[~2025-02-11 13:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-11 10:20 Charles Han
2025-02-11 10:42 ` [PATCH V3] drm: xlnx: zynqmp_dpsub: Add NULL checks in zynqmp_audio_init() Markus Elfring
2025-02-11 13:08 ` [PATCH V3] drm: xlnx: zynqmp_dpsub: Add NULL check in zynqmp_audio_init Tomi Valkeinen
2025-02-11 13:20   ` Tomi Valkeinen [this message]

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=192889ed-237e-40b0-8444-7aad36a8bc7a@ideasonboard.com \
    --to=tomi.valkeinen@ideasonboard.com \
    --cc=Markus.Elfring@web.de \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hanchunchao@inspur.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=michal.simek@amd.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    --cc=vishal.sagar@amd.com \
    /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

all inboxes | Powered by JetHome®