From: Shuah Khan <skhan@linuxfoundation.org>
To: "Colin King (gmail)" <colin.i.king@gmail.com>,
Fenghua Yu <fenghua.yu@intel.com>,
Reinette Chatre <reinette.chatre@intel.com>,
Shuah Khan <shuah@kernel.org>, Babu Moger <babu.moger@amd.com>,
Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>,
linux-kselftest@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH] selftests/resctrl: Fix null pointer dereference on open failed
Date: Mon, 25 Apr 2022 10:21:29 -0600 [thread overview]
Message-ID: <a238cdbb-e5fd-64f1-ea18-8ef2e7481d33@linuxfoundation.org> (raw)
In-Reply-To: <604ea061-c566-e032-67cf-9bc622aa76ae@gmail.com>
On 4/25/22 10:06 AM, Colin King (gmail) wrote:
> On 25/04/2022 16:51, Shuah Khan wrote:
>> On 4/24/22 3:15 PM, Colin Ian King wrote:
>>> Currently if opening /dev/null fails to open then file pointer fp
>>> is null and further access to fp via fprintf will cause a null
>>> pointer dereference. Fix this by returning a negative error value
>>> when a null fp is detected.
>>>
>>
>> How did you find this problem and how can it be reproduced? Is there
>> a case where test fails to open "/dev/null"?
>
> Found with static analysis, cppcheck. Open on /dev/null is unlikely to fail, but it's good to fail reliably rather than have a SIGSEGV :-)
>
I don't see how /dev/null open could fail here in this test.
However, I will take this fix. Please add information how
you found it and include the cppheck log in the commit log
and send me v2.
thanks,
-- Shuah
prev parent reply other threads:[~2022-04-25 16:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-24 21:15 [PATCH] selftests/resctrl: Fix null pointer dereference on open failed Colin Ian King
2022-04-25 15:51 ` Shuah Khan
2022-04-25 16:06 ` Colin King (gmail)
2022-04-25 16:21 ` Shuah Khan [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=a238cdbb-e5fd-64f1-ea18-8ef2e7481d33@linuxfoundation.org \
--to=skhan@linuxfoundation.org \
--cc=babu.moger@amd.com \
--cc=colin.i.king@gmail.com \
--cc=fenghua.yu@intel.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=reinette.chatre@intel.com \
--cc=sai.praneeth.prakhya@intel.com \
--cc=shuah@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.