From: Timur Tabi <timur@kernel.org>
To: Duoming Zhou <duoming@zju.edu.cn>
Cc: nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] nouveau/dmem: handle kcalloc() allocation failure
Date: Sun, 3 Mar 2024 21:02:32 -0600 [thread overview]
Message-ID: <CAOZdJXUebAScPBjJdCbdzzA_Hmotk11bd7MvLLxe+pqS5-upHQ@mail.gmail.com> (raw)
In-Reply-To: <20240303081330.61091-1-duoming@zju.edu.cn>
On Sun, Mar 3, 2024 at 4:46 AM Duoming Zhou <duoming@zju.edu.cn> wrote:
>
> The kcalloc() in nouveau_dmem_evict_chunk() will return null if
> the physical memory has run out. As a result, if we dereference
> src_pfns, dst_pfns or dma_addrs, the null pointer dereference bugs
> will happen.
>
> This patch uses stack variables to replace the kcalloc().
Won't this blow the stack? And why not just test the return value of kcalloc?
next prev parent reply other threads:[~2024-03-04 3:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-03 8:13 [PATCH] nouveau/dmem: handle kcalloc() allocation failure Duoming Zhou
2024-03-04 3:02 ` Timur Tabi [this message]
2024-03-04 12:14 ` Jani Nikula
2024-03-05 13:08 ` duoming
2024-03-05 13:26 ` Jani Nikula
[not found] <20240303075312.56349-1-duoming@zju.edu.cn>
2024-03-05 13:40 ` Danilo Krummrich
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=CAOZdJXUebAScPBjJdCbdzzA_Hmotk11bd7MvLLxe+pqS5-upHQ@mail.gmail.com \
--to=timur@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=duoming@zju.edu.cn \
--cc=nouveau@lists.freedesktop.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).