[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aAKDZCxGo9iZ7IBS@duo.ucw.cz>
Date: Fri, 18 Apr 2025 18:52:52 +0200
From: Pavel Machek <pavel@...x.de>
To: Sasha Levin <sashal@...nel.org>
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
Zhongqiu Han <quic_zhonhan@...cinc.com>,
Shuah Khan <skhan@...uxfoundation.org>, trenn@...e.com,
shuah@...nel.org, jwyatt@...hat.com, jkacur@...hat.com,
peng.fan@....com, linux-pm@...r.kernel.org
Subject: Re: [PATCH AUTOSEL 5.10 1/6] pm: cpupower: bench: Prevent NULL
dereference on malloc failure
Hi!
> [ Upstream commit 208baa3ec9043a664d9acfb8174b332e6b17fb69 ]
>
> If malloc returns NULL due to low memory, 'config' pointer can be NULL.
> Add a check to prevent NULL dereference.
This fixes nothing. We have oom killer, so we don't have malloc
returning NULL.
Best regards,
Pavel
> +++ b/tools/power/cpupower/bench/parse.c
> @@ -120,6 +120,10 @@ FILE *prepare_output(const char *dirname)
> struct config *prepare_default_config()
> {
> struct config *config = malloc(sizeof(struct config));
> + if (!config) {
> + perror("malloc");
> + return NULL;
> + }
>
> dprintf("loading defaults\n");
>
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)
Powered by blists - more mailing lists