From: "Christian König" <christian.koenig@amd.com>
To: xkernel.wang@foxmail.com, sumit.semwal@linaro.org
Cc: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org,
linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dma-buf: check the return value of kstrdup()
Date: Tue, 22 Feb 2022 12:31:52 +0100 [thread overview]
Message-ID: <e867e419-fa9f-e67f-bbfb-5261874c9d29@amd.com> (raw)
In-Reply-To: <tencent_22C6C2E595DEFED1417A98A5736539482809@qq.com>
Am 22.02.22 um 12:30 schrieb xkernel.wang@foxmail.com:
> From: Xiaoke Wang <xkernel.wang@foxmail.com>
>
> kstrdup() is a memory allocation function which can return NULL when
> some internaly memory errors happen. It is better to check the return
> value of it to prevent further wrong memory access.
>
> Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com>
Acked-by: Christian König <christian.koenig@amd.com>
> ---
> drivers/dma-buf/selftest.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/dma-buf/selftest.c b/drivers/dma-buf/selftest.c
> index c60b694..2c29e2a 100644
> --- a/drivers/dma-buf/selftest.c
> +++ b/drivers/dma-buf/selftest.c
> @@ -50,6 +50,9 @@ static bool apply_subtest_filter(const char *caller, const char *name)
> bool result = true;
>
> filter = kstrdup(__st_filter, GFP_KERNEL);
> + if (!filter)
> + return false;
> +
> for (sep = filter; (tok = strsep(&sep, ","));) {
> bool allow = true;
> char *sl;
next prev parent reply other threads:[~2022-02-22 11:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-22 11:30 [PATCH] dma-buf: check the return value of kstrdup() xkernel.wang
2022-02-22 11:31 ` Christian König [this message]
2022-02-22 13:41 ` Sumit Semwal
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=e867e419-fa9f-e67f-bbfb-5261874c9d29@amd.com \
--to=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=sumit.semwal@linaro.org \
--cc=xkernel.wang@foxmail.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