Messages in this thread | | | Date | Mon, 21 Mar 2022 14:24:05 +0100 | From | Petr Mladek <> | Subject | Re: [PATCH v2] livepatch: Reorder to use before freeing a pointer |
| |
On Sat 2022-03-19 18:51:43, trix@redhat.com wrote: > From: Tom Rix <trix@redhat.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@redhat.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@suse.com>
Best Regards, Petr
| |