Bug 103791 - modpost.c strncpy(...,NULL,0) undefined behaviour
Summary: modpost.c strncpy(...,NULL,0) undefined behaviour
Status: NEW
Alias: None
Product: Other
Classification: Unclassified
Component: Modules (show other bugs)
Hardware: x86-64 Linux
: P1 low
Assignee: other_modules
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-31 14:53 UTC by Vittorio
Modified: 2015-08-31 14:53 UTC (History)
0 users

See Also:
Kernel Version: 4.6.1
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Vittorio 2015-08-31 14:53:25 UTC
Trying to generate the kernel with gnu gcc -fsanitize=undefined I got a warning 
at modpost.c:2032

strncpy(buf->p + buf->pos, s, len);

because s == NULL but len == 0 so it should be harmless.
I fixed this one with the following

if(len) strncpy(buf->p + buf->pos, s, len);

Note You need to log in before you can comment on or make changes to this bug.