[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yjh8dX1iMsHUF4nU@alley>
Date: Mon, 21 Mar 2022 14:24:05 +0100
From: Petr Mladek <pmladek@...e.com>
To: trix@...hat.com
Cc: jpoimboe@...hat.com, jikos@...nel.org, mbenes@...e.cz,
joe.lawrence@...hat.com, nathan@...nel.org,
ndesaulniers@...gle.com, live-patching@...r.kernel.org,
linux-kernel@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH v2] livepatch: Reorder to use before freeing a pointer
On Sat 2022-03-19 18:51:43, trix@...hat.com wrote:
> From: Tom Rix <trix@...hat.com>
>
> Clang static analysis reports this issue
> livepatch-shadow-fix1.c:113:2: warning: Use of
> memory after it is freed
> pr_info("%s: dummy @ %p, prevented leak @ %p\n",
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> The pointer is freed in the previous statement.
> Reorder the pr_info to report before the free.
>
> Similar issue in livepatch-shadow-fix2.c
>
> Signed-off-by: Tom Rix <trix@...hat.com>
Strictly speaking, the freed memory is not used.
pr_info() only prints the address.
Anyway, I agree that the reordered code is cleaner.
Reviewed-by: Petr Mladek <pmladek@...e.com>
Best Regards,
Petr
Powered by blists - more mailing lists