All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@kernel.org>
To: Mohamed Ayman <mohamedaymanworkspace@gmail.com>,
	Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Alexandre Ghiti <alex@ghiti.fr>,
	Andrew Jones <ajones@ventanamicro.com>,
	Anup Patel <apatel@ventanamicro.com>,
	Conor Dooley <conor.dooley@microchip.com>,
	"open list:RISC-V ARCHITECTURE" <linux-riscv@lists.infradead.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] riscv: cpuinfo: Fix NULL dereference and inconsistent error code
Date: Sun, 3 May 2026 22:26:06 +1000	[thread overview]
Message-ID: <928b68db-4cf4-454c-aa88-3104e689a642@kernel.org> (raw)
In-Reply-To: <20260502161802.515547-1-mohamedaymanworkspace@gmail.com>

On 3/5/2026 02:17, Mohamed Ayman wrote:
> Fix a potential NULL pointer dereference in c_show() by ensuring
> the device tree node returned by of_get_cpu_node() is checked before use.

Where is the NULL pointer deref?

of_property_read_string() can cope with a NULL np, it just returns an error.

of_node_put() also handles a NULL np.

> Also replace a non-standard return value (-1) in
> riscv_of_parent_hartid() with -ENODEV to follow Linux kernel
> conventions for "not found" error returns.

That should be a separate patch. It does look like a good change. At 
least some of the callers of riscv_of_parent_hartid() pass the return 
value up to their callers, so -1 could be misinterpreted somewhere as EPERM.

cheers


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2026-05-03 12:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-02 16:17 [PATCH] riscv: cpuinfo: Fix NULL dereference and inconsistent error code Mohamed Ayman
2026-05-03 12:26 ` Michael Ellerman [this message]
2026-05-03 16:11   ` MOHAMED AYMAN
2026-05-03 16:19 ` [PATCH v3] riscv: Replace non-standard -1 return with -ENODEV in riscv_of_parent_hartid() Mohamed Ayman
  -- strict thread matches above, loose matches on Subject: below --
2026-05-02 16:02 [PATCH] riscv: cpuinfo: Fix NULL dereference and inconsistent error code Mohamed Ayman
2026-05-03 17:54 ` Conor Dooley

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=928b68db-4cf4-454c-aa88-3104e689a642@kernel.org \
    --to=mpe@kernel.org \
    --cc=ajones@ventanamicro.com \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=apatel@ventanamicro.com \
    --cc=conor.dooley@microchip.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=mohamedaymanworkspace@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=pjw@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.