All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
Cc: Naresh Kamboju
	<naresh.kamboju-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	linux-serial-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	open list <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Vinod Koul <vkoul-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Jiri Slaby <jslaby-IBi9RG/b67k@public.gmane.org>,
	linux-arm-msm
	<linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-tegra <linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	jirislaby-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	Greg Kroah-Hartman
	<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
	Andy Gross <agross-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Bjorn Andersson
	<bjorn.andersson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org,
	Thierry Reding
	<thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	Qian Cai <cai-J5quhbR+WMc@public.gmane.org>,
	lkft-triage-cunTk1MwBs8s++Sfvej+rw@public.gmane.org
Subject: Re: [qemu] boot failed: Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
Date: Mon, 6 Jul 2020 08:26:56 -0700	[thread overview]
Message-ID: <ea69a0f8-af48-45a3-7969-c38e0f785599@intel.com> (raw)
In-Reply-To: <CAK8P3a2LmUVj-yhwxXeCpqdxqJpp0m-q9q9SKQpfh3tFgMXPQA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>



On 7/6/2020 8:24 AM, Arnd Bergmann wrote:
> On Mon, Jul 6, 2020 at 5:01 PM Dave Jiang <dave.jiang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
>> On 7/6/2020 5:53 AM, Arnd Bergmann wrote:
>>> On Mon, Jul 6, 2020 at 1:03 PM Naresh Kamboju <naresh.kamboju-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
>>
>> Arnd,
>> I'm looking at the pl001_dma_probe(), I think we could make it more robust if it
>> uses IS_ERR_OR_NULL(chan) instead of IS_ERR(). Should I send a patch for it? I
>> suppose looking at the comment header for dma_request_chan() it does say return
>> chan ptr or error ptr. Sorry I missed that.
> 
> No. IS_ERR_OR_NULL() is almost always a mistake. A function should either
> return NULL on error, or it should return an error code, but should not be
> able to return either.

Fair enough.

> 
> Have you checked all the other 'return NULL' statements in your patch to
> ensure that they never return error pointers?

Yeah I looked over the rest of them. The ones that are returning NULL as far as 
I can tell are expected to return NULL.

> 
>         Arnd
> 

WARNING: multiple messages have this Message-ID (diff)
From: Dave Jiang <dave.jiang@intel.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Naresh Kamboju <naresh.kamboju@linaro.org>,
	linux-serial@vger.kernel.org,
	open list <linux-kernel@vger.kernel.org>,
	Vinod Koul <vkoul@kernel.org>, Jiri Slaby <jslaby@suse.com>,
	linux-arm-msm <linux-arm-msm@vger.kernel.org>,
	linux-tegra <linux-tegra@vger.kernel.org>,
	jirislaby@kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	ldewangan@nvidia.com, Thierry Reding <thierry.reding@gmail.com>,
	Jon Hunter <jonathanh@nvidia.com>, Qian Cai <cai@lca.pw>,
	lkft-triage@lists.linaro.org
Subject: Re: [qemu] boot failed: Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
Date: Mon, 6 Jul 2020 08:26:56 -0700	[thread overview]
Message-ID: <ea69a0f8-af48-45a3-7969-c38e0f785599@intel.com> (raw)
In-Reply-To: <CAK8P3a2LmUVj-yhwxXeCpqdxqJpp0m-q9q9SKQpfh3tFgMXPQA@mail.gmail.com>



On 7/6/2020 8:24 AM, Arnd Bergmann wrote:
> On Mon, Jul 6, 2020 at 5:01 PM Dave Jiang <dave.jiang@intel.com> wrote:
>> On 7/6/2020 5:53 AM, Arnd Bergmann wrote:
>>> On Mon, Jul 6, 2020 at 1:03 PM Naresh Kamboju <naresh.kamboju@linaro.org> wrote:
>>
>> Arnd,
>> I'm looking at the pl001_dma_probe(), I think we could make it more robust if it
>> uses IS_ERR_OR_NULL(chan) instead of IS_ERR(). Should I send a patch for it? I
>> suppose looking at the comment header for dma_request_chan() it does say return
>> chan ptr or error ptr. Sorry I missed that.
> 
> No. IS_ERR_OR_NULL() is almost always a mistake. A function should either
> return NULL on error, or it should return an error code, but should not be
> able to return either.

Fair enough.

> 
> Have you checked all the other 'return NULL' statements in your patch to
> ensure that they never return error pointers?

Yeah I looked over the rest of them. The ones that are returning NULL as far as 
I can tell are expected to return NULL.

> 
>         Arnd
> 

  parent reply	other threads:[~2020-07-06 15:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-06 11:03 [qemu] boot failed: Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 Naresh Kamboju
2020-07-06 11:03 ` Naresh Kamboju
     [not found] ` <CA+G9fYvqW-RQxt3kSoNkh5Y2REoe0QQB_dTz_KPzhJzcwiM5OA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-07-06 12:53   ` Arnd Bergmann
2020-07-06 12:53     ` Arnd Bergmann
     [not found]     ` <CAK8P3a1Lda8HhsDvDREf-cOgb4RkCgEKK5Q-Zj+UhK8tsAaBLw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-07-06 14:33       ` Dave Jiang
2020-07-06 14:33         ` Dave Jiang
2020-07-06 15:10         ` Vinod Koul
2020-07-06 15:01     ` Dave Jiang
     [not found]       ` <51d6e5bb-3de1-36dc-15a4-c341b23ca8cd-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2020-07-06 15:24         ` Arnd Bergmann
2020-07-06 15:24           ` Arnd Bergmann
     [not found]           ` <CAK8P3a2LmUVj-yhwxXeCpqdxqJpp0m-q9q9SKQpfh3tFgMXPQA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-07-06 15:26             ` Dave Jiang [this message]
2020-07-06 15:26               ` Dave Jiang
2020-07-06 17:36         ` Naresh Kamboju
2020-07-06 17:36           ` Naresh Kamboju

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=ea69a0f8-af48-45a3-7969-c38e0f785599@intel.com \
    --to=dave.jiang-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=agross-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=arnd-r2nGTMty4D4@public.gmane.org \
    --cc=bjorn.andersson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=cai-J5quhbR+WMc@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=jirislaby-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=jslaby-IBi9RG/b67k@public.gmane.org \
    --cc=ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-serial-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lkft-triage-cunTk1MwBs8s++Sfvej+rw@public.gmane.org \
    --cc=naresh.kamboju-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=vkoul-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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.