file removal issue in tools/testing/selftests/powerpc/mm/tlbie_test.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Static analysis with cppcheck has found an issue in the following commit:

commit 047e6575aec71d75b765c22111820c4776cd1c43
Author: Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxxxxxx>
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



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux