summaryrefslogtreecommitdiff
path: root/tools/perf/util/c++/clang-test.cpp
blob: 9b11e8c8279895909875f2444f044334829af797 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include "clang.h"
#include "clang-c.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/LLVMContext.h"

#include <util-cxx.h>
#include <tests/llvm.h>
#include <string>

class perf_clang_scope {
public:
	explicit perf_clang_scope() {perf_clang__init();}
	~perf_clang_scope() {perf_clang__cleanup();}
};

static std::unique_ptr<llvm::Module>
__test__clang_to_IR(void)
{
	unsigned int kernel_version;

	if (fetch_kernel_version(&kernel_version, NULL, 0))
		return std::unique_ptr<llvm::Module>(nullptr);

	std::string cflag_kver("-DLINUX_VERSION_CODE=" +
				std::to_string(kernel_version));

	std::unique_ptr<llvm::Module> M =
		perf::getModuleFromSource({cflag_kver.c_str()},
					  "perf-test.c",
					  test_llvm__bpf_base_prog);
	return M;
}

extern "C" {
int test__clang_to_IR(void)
{
	perf_clang_scope _scope;

	auto M = __test__clang_to_IR();
	if (!M)
		return -1;
	for (llvm::Function& F : *M)
		if (F.getName() == "bpf_func__SyS_epoll_wait")
			return 0;
	return -1;
}

int test__clang_to_obj(void)
{
	perf_clang_scope _scope;

	auto M = __test__clang_to_IR();
	if (!M)
		return -1;

	auto Buffer = perf::getBPFObjectFromModule(&*M);
	if (!Buffer)
		return -1;
	return 0;
}

}
m_wac_*_report' functions were written with the assumption that they would only be called once tablet setup had completed; 'wacom_wac_pen_report' in particular dereferences 'shared' which wasn't yet allocated). Moving the call to 'wacom_add_shared_data' effectively prevented the crash but also broke the sibiling detection code which assumes that the HID descriptor has been read and the various device_type flags set. To fix this situation, we restore the original 'wacom_add_shared_data' operation and location and instead implement an alternative change that can also prevent the crash. Specifically, we notice that the report functions mentioned above expect to be called only for input reports. By adding a check, we can prevent feature reports (such as the offset report) from causing trouble. Fixes: 345857bb49 ("HID: wacom: generic: Add support for sensor offsets") Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com> Tested-by: Ping Cheng <pingc@wacom.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/usb/host/fhci-dbg.c')