Bug 103791

Summary: modpost.c strncpy(...,NULL,0) undefined behaviour
Product: Other Reporter: Vittorio (zeccav)
Component: ModulesAssignee: other_modules
Status: NEW ---    
Severity: low    
Priority: P1    
Hardware: x86-64   
OS: Linux   
Kernel Version: 4.6.1 Subsystem:
Regression: No Bisected commit-id:

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);