mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Li zeming <zeming@nfschina.com>
To: andrew@lunn.ch, gregory.clement@bootlin.com,
	sebastian.hesselbarth@gmail.com
Cc: linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Li zeming <zeming@nfschina.com>
Subject: [PATCH] mach-mvebu: coherency: Judgment after pointer p increases allocation
Date: Mon, 21 Nov 2022 18:01:22 +0800	[thread overview]
Message-ID: <20221121100122.36528-1-zeming@nfschina.com> (raw)

Add judgment statements at the position after pointer p allocates memory
to avoid the abnormal impact of low probability allocation failure.

Signed-off-by: Li zeming <zeming@nfschina.com>
---
 arch/arm/mach-mvebu/coherency.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c
index a6b621ff0b87..2bc69dd059d6 100644
--- a/arch/arm/mach-mvebu/coherency.c
+++ b/arch/arm/mach-mvebu/coherency.c
@@ -191,8 +191,10 @@ static void __init armada_375_380_coherency_init(struct device_node *np)
 		struct property *p;
 
 		p = kzalloc(sizeof(*p), GFP_KERNEL);
-		p->name = kstrdup("arm,io-coherent", GFP_KERNEL);
-		of_add_property(cache_dn, p);
+		if (p) {
+			p->name = kstrdup("arm,io-coherent", GFP_KERNEL);
+			of_add_property(cache_dn, p);
+		}
 	}
 }
 
-- 
2.18.2


             reply	other threads:[~2022-11-21 10:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-21 10:01 Li zeming [this message]
2022-11-22  0:19 ` Andrew Lunn

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=20221121100122.36528-1-zeming@nfschina.com \
    --to=zeming@nfschina.com \
    --cc=andrew@lunn.ch \
    --cc=gregory.clement@bootlin.com \
    --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®