[bug report] modpost: handle relocations mismatch in __ex_table.

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

 



[ Ancient code warning. - dan ]

Hello Quentin Casasnovas,

The patch 52dc0595d540: "modpost: handle relocations mismatch in
__ex_table." from Apr 13, 2015, leads to the following Smatch static
checker warning:

	./scripts/mod/modpost.c:1154 is_executable_section()
	warn: array off by one? 'elf->sechdrs[secndx]'

./scripts/mod/modpost.c
    1149 static bool is_executable_section(struct elf_info *elf, unsigned int secndx)
    1150 {
    1151         if (secndx > elf->num_sections)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^
I'm not positive, but I think this should be >=.

    1152                 return false;
    1153 
--> 1154         return (elf->sechdrs[secndx].sh_flags & SHF_EXECINSTR) != 0;
                                      ^^^^^^
out of bounds read.

    1155 }

regards,
dan carpenter



[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux