1 /* Reduced from false positive in Linux kernel
2 in drivers/char/ipmi/ipmi_devintf.c. */
4 /* { dg-do compile } */
5 /* { dg-options "-fanalyzer -O2 -Wno-attributes" } */
6 /* { dg-require-effective-target analyzer } */
8 typedef __SIZE_TYPE__
size_t;
10 __check_object_size(const void* ptr
, unsigned long n
);
13 copy_from_user(void*, const void*, unsigned long);
15 __attribute__((__always_inline__
)) unsigned long
16 call_copy_from_user(void* to
, const void* from
, unsigned long n
)
18 __check_object_size(to
, n
);
19 n
= copy_from_user(to
, from
, n
); /* { dg-bogus "use of attacker-controlled value as size without upper-bounds checking" } */
24 unsigned short data_len
;
29 handle_send_req(struct ipmi_msg
* msg
)
32 if (msg
->data_len
> 272) {
35 if (call_copy_from_user(buf
, msg
->data
, msg
->data_len
)) {
44 if (call_copy_from_user(&msg
, arg
, sizeof(msg
))) {
48 return handle_send_req(&msg
);