| 1 |
/* Reduced from false positive in Linux kernel's fs/ceph/ioctl.c: */ |
| 2 |
|
| 3 |
__extension__ typedef unsigned long long __u64; |
| 4 |
|
| 5 |
struct ceph_ioctl_layout |
| 6 |
{ |
| 7 |
__u64 stripe_unit, object_size; |
| 8 |
}; |
| 9 |
static long |
| 10 |
__validate_layout(struct ceph_ioctl_layout* l) |
| 11 |
{ |
| 12 |
if ((l->object_size & ~(~(((1UL) << 12) - 1))) || |
| 13 |
(l->stripe_unit & ~(~(((1UL) << 12) - 1))) || |
| 14 |
((unsigned)l->stripe_unit != 0 && |
| 15 |
((unsigned)l->object_size % (unsigned)l->stripe_unit))) /* { dg-bogus "use of attacker-controlled value 'l.stripe_unit' as divisor without checking for zero" "PR analyzer/113619" } */ |
| 16 |
return -22; |
| 17 |
return 0; |
| 18 |
} |
| 19 |
|
| 20 |
long |
| 21 |
__attribute__((tainted_args)) |
| 22 |
ceph_ioctl_set_layout_policy(struct ceph_ioctl_layout l) |
| 23 |
{ |
| 24 |
int err; |
| 25 |
err = __validate_layout(&l); |
| 26 |
if (err) |
| 27 |
return err; |
| 28 |
return err; |
| 29 |
} |