From: Sergei Trofimovich <[email protected]>
objtool: check: give big enough buffer for pv_ops
On gcc-12 build fails flagging possible buffer overflow:
check.c: In function 'validate_call':
check.c:2865:58: error: '%d' directive output may be truncated writing
between 1 and 10 bytes into a region of size 9 [-Werror=format-truncation=]
2865 | snprintf(pvname, sizeof(pvname), "pv_ops[%d]", idx);
| ^~
I think it's a valid warning:
static char pvname[16];
int idx;
...
idx = (rel->addend / sizeof(void *));
snprintf(pvname, sizeof(pvname), "pv_ops[%d]", idx);
we have only 7 chars for %d while it could take up to 9.
CC: Josh Poimboeuf <[email protected]>
CC: Peter Zijlstra <[email protected]>
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index blahblah..blahblah 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -2854,7 +2854,7 @@ static inline bool func_uaccess_safe(struct symbol *func)
static inline const char *call_dest_name(struct instruction *insn)
{
- static char pvname[16];
+ static char pvname[32];
struct reloc *rel;
int idx;
--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1586
_______________________________________________
kernel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedoraproject.org/archives/list/[email protected]
Do not reply to spam on the list, report it:
https://pagure.io/fedora-infrastructure