mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Li Jun <lijun01@kylinos.cn>
Cc: gregory.clement@bootlin.com, sebastian.hesselbarth@gmail.com,
	linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4] arm: mvebu: fix null pointer when access
Date: Wed, 18 Mar 2026 14:38:54 +0100	[thread overview]
Message-ID: <4ba47ee5-a353-4083-a16e-b46afddd0d81@lunn.ch> (raw)
In-Reply-To: <20260318085923.2610585-1-lijun01@kylinos.cn>

On Wed, Mar 18, 2026 at 04:59:23PM +0800, Li Jun wrote:
> the kzalloc&kstrdup may return null pointer, will cause kernel panic.
> 
> -Fix null pointer.
> 
> Signed-off-by: Li Jun <lijun01@kylinos.cn>
> ---
>  arch/arm/mach-mvebu/board-v7.c      | 10 ++++++++++
>  arch/arm/mach-mvebu/coherency.c     |  6 ++++++
>  arch/arm/mach-mxs/mach-mxs.c        |  4 ++--
>  arch/arm/mach-versatile/versatile.c |  6 ++++++

4 versions in less than 24 hours....

Also, please don't mix different machine architectures together in one
patch. They have different Maintainers.

> diff --git a/arch/arm/mach-mvebu/board-v7.c b/arch/arm/mach-mvebu/board-v7.c
> index 04ad651d13a0..a3b1aa48162b 100644
> --- a/arch/arm/mach-mvebu/board-v7.c
> +++ b/arch/arm/mach-mvebu/board-v7.c
> @@ -128,11 +128,21 @@ static void __init i2c_quirk(void)
>  		struct property *new_compat;
>  
>  		new_compat = kzalloc(sizeof(*new_compat), GFP_KERNEL);
> +		if (!new_compat)
> +			return -ENOMEM;

When you compiled this, did you get any sort of warning? As you can
see above i2c_quirk() is a void function.

    Andrew

      parent reply	other threads:[~2026-03-18 13:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-18  8:59 Li Jun
2026-03-18  9:33 ` Gregory CLEMENT
2026-03-18 13:38 ` Andrew Lunn [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=4ba47ee5-a353-4083-a16e-b46afddd0d81@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=gregory.clement@bootlin.com \
    --cc=lijun01@kylinos.cn \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=sebastian.hesselbarth@gmail.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

all inboxes | Powered by JetHome®