Bug 14616

Summary: Printf format code and data type do not match in taskset
Product: Busybox Reporter: pdvb
Component: OtherAssignee: unassigned
Status: RESOLVED FIXED    
Severity: normal CC: busybox-cvs
Priority: P5    
Version: 1.33.x   
Target Milestone: ---   
Hardware: Other   
OS: Linux   
Host: Target:
Build:

Description pdvb 2022-02-28 19:15:08 UTC
The following code uses an (unsigned long) "%lx" format code, but passes an (unsigned long long) value to printf.  The result is that on architectures which use 32-bit for (unsigned long) and 64-bit for (unsigned long long) the printf produces incorrect output.

#define TASKSET_PRINTF_MASK "%lx"
static unsigned long long from_mask(ul *mask, unsigned sz_in_bytes UNUSED_PARAM)
{
	return *mask;
}


This was broken by commit ef0e76cc on 1/29/2017
The quick fix is to define the function as:

static unsigned long from_mask()
Comment 1 Denys Vlasenko 2022-03-01 09:49:56 UTC
Fixed in git, thank you.