[<prev] [next>] [day] [month] [year] [list]
Message-ID: <7a853516-9da5-811b-1e9c-84e5483a8a08@gmail.com>
Date: Thu, 15 Jun 2023 17:02:18 +0100
From: "Colin King (gmail)" <colin.i.king@...il.com>
To: Michael Ellerman <mpe@...erman.id.au>,
Nicholas Piggin <npiggin@...il.com>,
Christophe Leroy <christophe.leroy@...roup.eu>,
Shuah Khan <shuah@...nel.org>,
Nicholas Miehlbradt <nicholas@...ux.ibm.com>,
Nicholas Miehlbradt <nicholas@...ux.ibm.com>,
Benjamin Gray <bgray@...ux.ibm.com>
Cc: "open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@...r.kernel.org>,
"linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: file removal issue in tools/testing/selftests/powerpc/mm/tlbie_test.c
Hi,
Static analysis with cppcheck has found an issue in the following commit:
commit 047e6575aec71d75b765c22111820c4776cd1c43
Author: Aneesh Kumar K.V <aneesh.kumar@...ux.ibm.com>
Date: Tue Sep 24 09:22:53 2019 +0530
powerpc/mm: Fixup tlbie vs mtpidr/mtlpidr ordering issue on POWER9
The issue in tools/testing/selftests/powerpc/mm/tlbie_test.c in
end_verification_log() is as follows:
static inline void end_verification_log(unsigned int tid, unsigned
nr_anamolies)
{
FILE *f = fp[tid];
char logfile[30];
char path[LOGDIR_NAME_SIZE + 30];
char separator[] = "/";
fclose(f);
if (nr_anamolies == 0) {
remove(path);
return;
}
.... etc
in the case where nr_anamolies is zero the remove(path) call is using an
uninitialized path, this potentially could contain uninitialized garbage
on the stack (and if one is unlucky enough it may be a valid filename
that one does not want to be removed).
Not sure what the original intention was, but this code looks incorrect
to me.
Colin
Powered by blists - more mailing lists