Bug 14616 - Printf format code and data type do not match in taskset
Summary: Printf format code and data type do not match in taskset
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: 1.33.x
Hardware: Other Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-02-28 19:15 UTC by pdvb
Modified: 2022-03-01 09:49 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.