]> git.baikalelectronics.ru Git - kernel.git/commit
modpost: add array range check to sec_name()
authorMasahiro Yamada <masahiroy@kernel.org>
Sat, 30 Jul 2022 17:36:34 +0000 (02:36 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Wed, 3 Aug 2022 13:58:10 +0000 (22:58 +0900)
commit3958cc4f6820715be07745f20e69287d1f9f2476
tree82a7e0f4e2880d7219ad494c7abc71a2c7e241b8
parent3cafff941242cc6396cadcffb3b0c78d54b64ddb
modpost: add array range check to sec_name()

The section index is always positive, so the argument, secindex, should
be unsigned.

Also, inserted the array range check.

If sym->st_shndx is a special section index (between SHN_LORESERVE and
SHN_HIRESERVE), there is no corresponding section header.

For example, if a symbol specifies an absolute value, sym->st_shndx is
SHN_ABS (=0xfff1).

The current users do not cause the out-of-range access of
info->sechddrs[], but it is better to avoid such a pitfall.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
scripts/mod/modpost.c