From: Yao Zi <me@ziyao.cc>
To: "Rong Zhang" <rongrong@oss.cipunited.com>,
"Huacai Chen" <chenhuacai@kernel.org>,
"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
"Thomas Bogendoerfer" <tsbogend@alpha.franken.de>
Cc: <linux-mips@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
"Icenowy Zheng" <uwu@icenowy.me>, "Rong Zhang" <i@rong.moe>,
<stable@vger.kernel.org>
Subject: Re: [PATCH] MIPS: Loongson64: env: Check UARTs passed by LEFI cautiously
Date: Sun, 15 Mar 2026 11:41:16 +0000 [thread overview]
Message-ID: <abaa3Nb5P_6wUtxL@pie> (raw)
In-Reply-To: <20260314211336.408561-1-rongrong@oss.cipunited.com>
On Sun, Mar 15, 2026 at 05:13:29AM +0800, Rong Zhang wrote:
> Some firmware does not set nr_uarts properly and passes empty items.
> Iterate at most min(system->nr_uarts, MAX_UARTS) items to prevent
> out-of-bounds access, and ignore UARTs with addr 0 silently.
>
> Meanwhile, our DT only works with UPIO_MEM but theoretically firmware
> may pass other IO types, so explicitly check against that.
>
> Tested on Loongson-LS3A4000-7A1000-NUC-SE.
>
> Fixes: 3989ed418483 ("MIPS: Loongson64: env: Fixup serial clock-frequency when using LEFI")
> Cc: stable@vger.kernel.org
> Signed-off-by: Rong Zhang <rongrong@oss.cipunited.com>
> ---
> arch/mips/loongson64/env.c | 18 +++++++++++++++++-
> 1 file changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/arch/mips/loongson64/env.c b/arch/mips/loongson64/env.c
> index 11ddf02d6a15..c6b99b3740ea 100644
> --- a/arch/mips/loongson64/env.c
> +++ b/arch/mips/loongson64/env.c
> @@ -17,8 +17,10 @@
> #include <linux/dma-map-ops.h>
> #include <linux/export.h>
> #include <linux/libfdt.h>
> +#include <linux/minmax.h>
> #include <linux/pci_ids.h>
> #include <linux/string_choices.h>
> +#include <linux/serial_core.h>
Maybe putting this before string_choices.h to keep the headers sorted
at least locally? Though the order is already broken, this may minimize
the diff if someone is willing to sort them later.
> #include <asm/bootinfo.h>
> #include <loongson.h>
> #include <boot_param.h>
Reviewed-by: Yao Zi <me@ziyao.cc>
Thanks,
Yao Zi
next prev parent reply other threads:[~2026-03-15 11:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-14 21:13 [PATCH] MIPS: Loongson64: env: Check UARTs passed by LEFI cautiously Rong Zhang
2026-03-15 11:41 ` Yao Zi [this message]
2026-03-15 17:28 ` [PATCH v2] " Rong Zhang
2026-03-17 10:58 ` Jiaxun Yang
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=abaa3Nb5P_6wUtxL@pie \
--to=me@ziyao.cc \
--cc=chenhuacai@kernel.org \
--cc=i@rong.moe \
--cc=jiaxun.yang@flygoat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=rongrong@oss.cipunited.com \
--cc=stable@vger.kernel.org \
--cc=tsbogend@alpha.franken.de \
--cc=uwu@icenowy.me \
/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